#include <cstdio>
#include <vector>
#include <algorithm>
#include <cassert>

using std::vector;

static inline int sign(int x) {
  if (x > 0) {
    return 1;
  } else if (x < 0) {
    return -1;
  } else {
    return 0;
  }
}

static inline bool isNeedStartNew(int lastSum, int next) {
  int sign1 = sign(lastSum);
  int sign2 = sign(next);
  enum {
    NO,
    YES,
    ANY,
    IF_SUM_NON_POSITIVE
  };
  const static int arr[9] = {NO, YES /*bug!*/, IF_SUM_NON_POSITIVE,
                             YES, ANY, YES,
                             IF_SUM_NON_POSITIVE, NO, YES};
  switch (arr[(sign1 + 1) * 3 + sign2 + 1]) {
    case NO:
      return false;
    case YES:
      return true;
    case ANY:
      return (rand() & 1) != 0;
    case IF_SUM_NON_POSITIVE:
      return lastSum + next <= 0;
    default:
      assert(0);
  }
}

int main() {
  freopen("demo.in", "r", stdin);
  freopen("demo.out", "w", stdout);

  int n, l, r;
  scanf("%d%d%d", &n, &l, &r);
  vector <int> a(n);
  for (int i = 0; i < n; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    a[i] = (x - y);
  }

  vector <int> res;
  vector <int> stack;
  stack.push_back(a[0]);
  res.push_back(0);
  for (int i = 1; i < n; ++i) {
    if (i - res.back() < l || i - res.back() == r || isNeedStartNew(stack.back(), a[i])) {
      res.push_back(i);
      stack.push_back(a[i]);
    } else {
      stack.back() += a[i];
    }
  }
  res.push_back(n);

  int x = int(res.size()) - 1;
  printf("%d\n", x);
  for (int i = 1; i <= x; ++i) {
    printf("%d %d\n", res[i - 1] + 1, res[i]);
  }

  return 0;
}
