Problem: Silver Fox is fighting with N monsters.

The monsters are standing in a row, and we can assume them to be standing on a number line. The i-th monster, standing at the coordinate X_i, has the health of H_i.

Silver Fox can use bombs to attack the monsters. Using a bomb at the coordinate x decreases the healths of all monsters between the coordinates x-D and x+D (inclusive) by A. There is no way other than bombs to decrease the monster's health.

Silver Fox wins when all the monsters' healths become 0 or below.

Find the minimum number of bombs needed to win.

Constraints

* 1 \leq N \leq 2 \times 10^5
* 0 \leq D \leq 10^9
* 1 \leq A \leq 10^9
* 0 \leq X_i \leq 10^9
* 1 \leq H_i \leq 10^9
* X_i are distinct.
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


N D A
X_1 H_1
:
X_N H_N


Output

Print the minimum number of bombs needed to win.

Examples

Input

3 3 2
1 2
5 4
9 2


Output

2


Input

9 4 1
1 5
2 4
3 3
4 2
5 1
6 2
7 3
8 4
9 5


Output

5


Input

3 0 1
300000000 1000000000
100000000 1000000000
200000000 1000000000


Output

3000000000

Solution (in JAVA):

Solution:
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;

public class Main {

    static final long DIV = 1000000007;
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        long d = sc.nextLong();
        long a = sc.nextLong();
        long[][] x = new long[n][2];

        for (int i = 0; i < x.length; i++) {
            x[i][0] = sc.nextLong();
            x[i][1] = sc.nextLong();
        }

        Arrays.sort(x, (xa, xb)-> Long.compare(xa[0], xb[0]));

        int pos = 0;
        int mpos = 0;
        long ans = 0;

        int size = 1 << 22;
        int size2 = 1 << 20;
        long[] ha = new long[size];
        long[] hb = new long[size];



        if(n == 1){
            long mans = x[0][1] / a;
            if(x[0][1] % a != 0) mans++;
            System.out.println(mans);
            return;
        }

        for (int i = 0; i < n; i++) {
            add(ha, hb, i, i+1, x[i][1], 0, 0, size2);
        }

        out: while(pos < n){
            x[pos][1] = sum(ha, hb, pos, pos+1, 0, 0, size2);
            if(x[pos][1] <= 0){
                pos++;
                continue;
            }
            long num = x[pos][1] / a;
            if(x[pos][1] % a != 0) num++;

            while(x[mpos][0] <= x[pos][0] + 2 * d){
                if(mpos >= n-1) break;
                if(x[mpos+1][0] > x[pos][0] + 2 * d) break;
                mpos++;
            }
            
            // for(; x[mpos+1][0] <= x[pos][0] + 2 * d; mpos++){
            //     if(mpos >= n - 2){
            //         mpos++;
            //         break;
            //     }
            // }

            add(ha, hb, pos, mpos+1, -1*a*num, 0, 0, size2);

            // for (int i = pos; i <= mpos; i++) {
            //     x[i][1] -= a * num;
            // }

            pos++;
            ans += num;
            // if(sum(ha, hb, 0, n, 0, 0, size2) == 0) break;
        }

        System.out.println(ans);
    }

    static void add(long[] ha, long[] hb, int a, int b, long x, int k, int l, int r){
        if(a <= l && r <= b){
            ha[k] += x;
        }else if (l < b && a < r){
            hb[k] += (Math.min(b, r) - Math.max(a, l)) * x;
            add(ha, hb, a, b, x, k* 2 + 1, l, (l + r) / 2);
            add(ha, hb, a, b, x, k * 2 + 2, (l + r) / 2, r);
        }
    }

    static long sum(long[] ha, long[] hb, int a, int b, int k, int l, int r){
        if(b <= l || r <= a){
            return 0;
        }else if (a <= l &&  r <= b){
            return ha[k] * (r - l) + hb[k];
        }else{
            long res = (Math.min(b, r) - Math.max(a, l)) * ha[k];
            res += sum(ha, hb, a, b, k * 2 + 1, l, (l + r) / 2);
            res += sum(ha, hb, a, b, k * 2 + 2, (l + r) / 2, r);
            return res;
        }

    }



    private static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (hasNextByte())
                return buffer[ptr++];
            else
                return -1;
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        public boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr]))
                ptr++;
            return hasNextByte();
        }

        public String next() {
            if (!hasNext())
                throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public long nextLong() {
            if (!hasNext())
                throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
                throw new NumberFormatException();
            return (int) nl;
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }

}