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

using std::vector;

const int INF = (1 << 29);

static inline int sign(int x) {
  if (x > 0) {
    return 1;
  } else if (x < 0) {
    return -1;
  } else {
    return 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> sum(n + 1, 0);
  for (int i = 1; i <= n; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    sum[i] = sum[i - 1] + (x - y);
  }

  vector <int> dp(n + 1, 0);
  vector <int> prev(n + 1, -1);
  for (int i = 1; i <= n; ++i) {
    dp[i] = -INF;
    for (int j = l; j <= i && j <= r; ++j) {
      int cur = dp[i - j] + sign(sum[i] - sum[i - j]);
      if (cur > dp[i]) {
        dp[i] = cur;
        prev[i] = i - j;
      }
    }
  }

  vector <int> res;
  int cur;
  for (cur = n; cur > 0; cur = prev[cur]) {
    res.push_back(cur);
  }
  assert(cur == 0);
  res.push_back(0);

  std::reverse(res.begin(), res.end());

  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;
}
