import java.io.*;
import java.util.*;
 
public class demo_av {
 
    FastScanner in;
    PrintWriter out;
 
    class Pair implements Comparable<Pair> {
        int value, idx;
 
        public Pair(int value, int idx) {
            super();
            this.value = value;
            this.idx = idx;
        }
 
        @Override
        public int compareTo(Pair o) {
            return Integer.compare(value, o.value);
        }
    }
 
    final int INF = Integer.MIN_VALUE / 2;
 
    class SegmentTree {
        int[] max;
        int[] value;
        int size;
 
        public SegmentTree(int n) {
            max = new int[n * 4];
            value = new int[n * 4];
            size = n;
            build(0, size, 0);
        }
 
        void build(int left, int right, int i) {
            if (left + 1 == right) {
                value[left] = INF;
                max[i] = left;
                return;
            }
            int mid = (left + right) >>> 1;
            build(left, mid, i * 2 + 1);
            build(mid, right, i * 2 + 2);
            max[i] = best(max[i * 2 + 1], max[i * 2 + 2]);
        }
 
        int best(int i1, int i2) {
            if (i1 == -1) {
                return i2;
            }
            if (i2 == -1) {
                return i1;
            }
            return value[i1] > value[i2] ? i1 : i2;
        }
 
        void set(int pos, int value) {
            set(0, size, pos, value, 0);
        }
 
        void set(int left, int right, int pos, int val, int i) {
            if (left + 1 == right) {
                max[i] = left;
                value[left] = val;
                return;
            }
            int mid = (left + right) >> 1;
            if (pos < mid) {
                set(left, mid, pos, val, i * 2 + 1);
            } else {
                set(mid, right, pos, val, i * 2 + 2);
            }
            max[i] = best(max[i * 2 + 1], max[i * 2 + 2]);
        }
 
        int get(int l, int r) {
            return get(0, size, l, r + 1, 0);
        }
 
        int get(int left, int right, int l, int r, int i) {
            if (l <= left && right <= r) {
                return max[i];
            }
            if (right <= l || r <= left) {
                return -1;
            }
            int mid = (left + right) >>> 1;
            return best(get(left, mid, l, r, 2 * i + 1),
                    get(mid, right, l, r, 2 * i + 2));
        }
    }
 
    void solve() {
        int n = in.nextInt();
        int l = in.nextInt();
        int r = in.nextInt();
        int[] pref = new int[n + 1];
        pref[0] = 0;
        for (int i = 0; i < n; i++) {
            pref[i + 1] += in.nextInt();
            pref[i + 1] -= in.nextInt();
            pref[i + 1] += pref[i];
        }
        Pair[] a = new Pair[n + 1];
        for (int i = 0; i <= n; i++) {
            a[i] = new Pair(pref[i], i);
        }
        Pair[] sorted = a.clone();
        Arrays.sort(sorted);
        int[] pos = new int[n + 1];
        for (int i = 0; i <= n; i++) {
            pos[sorted[i].idx] = i;
        }
 
        int[] dp = new int[n + 1];
        int[] prev = new int[n + 1];
        Arrays.fill(dp, INF);
        dp[0] = 0;
 
        SegmentTree tree = new SegmentTree(n + 1);
        if (l == 1) {
            tree.set(pos[0], dp[0]);
        }
        for (int i = 1; i <= n; i++) {
            Pair p = a[i];
            int leftEq = -1, rightEq = -1;
            {
                int left = -1, right = n + 1;
                while (left < right - 1) {
                    int mid = (left + right) >>> 1;
                    if (sorted[mid].value < p.value) {
                        left = mid;
                    } else {
                        right = mid;
                    }
                }
                leftEq = right;
            }
            {
                int left = -1, right = n + 1;
                while (left < right - 1) {
                    int mid = (left + right) >>> 1;
                    if (sorted[mid].value <= p.value) {
                        left = mid;
                    } else {
                        right = mid;
                    }
                }
                rightEq = left;
            }
 
            if (leftEq > 0) {
                int treeIdx = tree.get(0, leftEq - 1);
                if (tree.value[treeIdx] != INF) {
                    int prev1 = sorted[treeIdx].idx;
                    if (dp[i] < dp[prev1] + 1) {
                        dp[i] = dp[prev1] + 1;
                        prev[i] = prev1;
                    }
                }
            }
            {
                int treeIdx = tree.get(leftEq, rightEq);
                if (tree.value[treeIdx] != INF) {
                    int prev1 = sorted[treeIdx].idx;
                    if (dp[i] < dp[prev1]) {
                        dp[i] = dp[prev1];
                        prev[i] = prev1;
                    }
                }
            }
            if (rightEq + 1 <= n) {
                int treeIdx = tree.get(rightEq + 1, n);
                if (tree.value[treeIdx] != INF) {
                    int prev1 = sorted[treeIdx].idx;
                    if (dp[i] < dp[prev1] - 1) {
                        dp[i] = dp[prev1] - 1;
                        prev[i] = prev1;
                    }
                }
            }
            if (i - l + 1 >= 0) {
                tree.set(pos[i - l + 1], dp[i - l + 1]);
            }
            if (i - r >= 0) {
                tree.set(pos[i - r], INF);
            }
        }
        List<Integer> result = new ArrayList<>();
        int pr = n;
        while (pr > 0) {
            result.add(pr);
            pr = prev[pr];
        }
        result.add(pr);
        Collections.reverse(result);
        out.println(result.size() - 1);
        for (int i = 0; i < result.size() - 1; i++) {
            out.println((result.get(i) + 1) + " " + (result.get(i + 1)));
        }
    }
 
    void run() {
        try {
            in = new FastScanner("demo.in");
            out = new PrintWriter("demo.out");
            solve();
            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }
 
    class FastScanner {
        BufferedReader br;
        StringTokenizer st;
 
        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }
 
        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt() {
            return Integer.parseInt(nextToken());
        }
 
        long nextLong() {
            return Long.parseLong(nextToken());
        }
 
        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
 
    public static void main(String[] args) {
        new demo_av().run();
    }
}
