#include <bits/stdc++.h>
 
using namespace std;
 
#define FILENAME "demo"
 
const int inf = (int)1e9;
 
const pair <int, int> NONE = make_pair(-inf, -1);
 
const int N = 1234567;
 
pair <int, int> mx[N];
int t;
 
void modify(int x, int l, int r, int p, pair <int, int> v) {
  if (l == r) {
    mx[x] = v;
    return;
  }
  int y = (l + r) >> 1;
  if (p <= y) {
    modify(x + x, l, y, p, v);
  } else {
    modify(x + x + 1, y + 1, r, p, v);
  }
  mx[x] = max(mx[x + x], mx[x + x + 1]);
}
 
pair <int, int> find_max(int x, int l, int r, int ll, int rr) {
  if (r < ll || rr < l) {
    return NONE;
  }
  if (ll <= l && r <= rr) {
    return mx[x];
  }
  int y = (l + r) >> 1;
  return max(find_max(x + x, l, y, ll, rr), find_max(x + x + 1, y + 1, r, ll, rr));
}
 
set < pair <int, int> > values[N];
 
void add(int pos, pair <int, int> p) {
  values[pos].insert(p);
  pair <int, int> top = *(--values[pos].end());
  modify(1, 1, t, pos, top);
}
 
void del(int pos, pair <int, int> p) {
  values[pos].erase(p);
  pair <int, int> top = values[pos].empty() ? NONE : *(--values[pos].end());
  modify(1, 1, t, pos, top);
}
 
int s[N];
pair <int, int> ev[N];
int f[N], pr[N];
 
int main() {
  freopen(FILENAME ".in", "r", stdin);
  freopen(FILENAME ".out", "w", stdout);
  int n, l, r;
  scanf("%d %d %d", &n, &l, &r);
  s[0] = 0;
  for (int i = 0; i < n; i++) {
    int foo, bar;
    scanf("%d %d", &foo, &bar);
    s[i + 1] = s[i] + foo - bar;
  }
  for (int i = 0; i <= n; i++) {
    ev[i] = make_pair(s[i], i);
  }
  sort(ev, ev + n + 1);
  t = 1;
  for (int i = 0; i <= n; i++) {
    if (i == 0 || ev[i].first != ev[i - 1].first) {
      t++;
    }
    s[ev[i].second] = t;
  }
  t++;
  for (int i = 0; i < N; i++) {
    mx[i] = NONE;
  }
  for (int i = 1; i <= t; i++) {
    values[i].clear();
  }
  f[0] = 0;
  if (l == 1) {
    add(s[0], make_pair(0, 0));
  }
  for (int i = 1; i <= n; i++) {
    pair <int, int> a = find_max(1, 1, t, 1, s[i] - 1);
    a.first++;
    pair <int, int> b = find_max(1, 1, t, s[i], s[i]);
    pair <int, int> c = find_max(1, 1, t, s[i] + 1, t);
    c.first--;
    pair <int, int> p = max(max(a, b), c);
    f[i] = p.first;
    pr[i] = p.second;
    if (i - l + 1 >= 0) {
      add(s[i - l + 1], make_pair(f[i - l + 1], i - l + 1));
    }
    if (i - r >= 0) {
      del(s[i - r], make_pair(f[i - r], i - r));
    }
  }
  vector < pair <int, int> > e;
  int pos = n;
  while (pos > 0) {
    e.push_back(make_pair(pr[pos] + 1, pos));
    pos = pr[pos];
  }
  int sz = e.size();
  printf("%d\n", sz);
  for (int i = sz - 1; i >= 0; i--) {
    printf("%d %d\n", e[i].first, e[i].second);
  }
  return 0;
}
