class Bit:

    def __init__(self, n):

        self.size = n

        self.tree = [0] * (n + 1)

 

    def sum(self, i):

        s = 0

        while i > 0:

            s += self.tree[i]

            i -= i & -i

        return s

 

    def add(self, i, x):

        while i <= self.size:

            self.tree[i] += x

            i += i & -i

N, D, A = list(map(int, input().split()))



ys = []

for _ in range(N):

    X, H = list(map(int, input().split()))

    ys.append((2*X, -(-H//A)))

    ys.append((2*X+4*D+1, -(-H//A)))



ys = sorted(ys, key=lambda x : x[0])

d1 = dict()

d2 = dict()

ls = []

c = 0

hs = [0]

for i, (y, h) in enumerate(ys):

    if y%2:

        d1[y-1-4*D] = c

    else:

        c += 1

        d2[y] = c

        ls.append(y)

        hs.append(h)



lls = []

for i in range(N):

    lls.append(d1[ls[i]]-d2[ls[i]]+1)



X = Bit(N+1)



r = 0

for i in range(N):

    n = lls[i]

    x = hs[i+1] + X.sum(i+1)

    if x <=0:

        continue

    r += x

    X.add(i+1, -x)

    X.add(i+1+n, x)

print(r)

from collections import deque

N, D, A = list(map(int, input().split()))



ys = []

hs = []

for i in range(N):

    X, H = list(map(int, input().split()))

    ys.append((X,i))

    hs.append(-(-H//A))



ys = sorted(ys, key=lambda x : x[0])

l = ys[0][0] + 2*D

li = 0

dmg = 0

r = 0

for y, i in ys:

    while (not l >= y):

        li += 1

        l = ys[li][0] + 2*D

        dmg -= hs[ys[li-1][1]]

    tr = max(0, hs[i]-dmg)

    hs[i] = tr

    dmg += tr

    r += tr

print(r)

class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i


N, D, A = list(map(int, input().split()))
ys = []
for _ in range(N):
    X, H = list(map(int, input().split()))
    ys.append((2 * X, -(-H // A)))
    ys.append((2 * X + 4 * D + 1, -(-H // A)))
ys = sorted(ys, key=lambda x: x[0])
d1 = dict()
d2 = dict()
ls = []
c = 0
hs = [0]
for i, (y, h) in enumerate(ys):
    if y % 2:
        d1[y - 1 - 4 * D] = c
    else:
        c += 1
        d2[y] = c
        ls.append(y)
        hs.append(h)
lls = []
for i in range(N):
    lls.append(d1[ls[i]] - d2[ls[i]] + 1)
X = Bit(N + 1)
r = 0
for i in range(N):
    n = lls[i]
    x = hs[i + 1] + X.sum(i + 1)
    if x <= 0:
        continue
    r += x
    X.add(i + 1, -x)
    X.add(i + 1 + n, x)
print(r)

from collections import deque

N, D, A = list(map(int, input().split()))
ys = []
hs = []
for i in range(N):
    X, H = list(map(int, input().split()))
    ys.append((X, i))
    hs.append(-(-H // A))
ys = sorted(ys, key=lambda x: x[0])
l = ys[0][0] + 2 * D
li = 0
dmg = 0
r = 0
for y, i in ys:
    while not l >= y:
        li += 1
        l = ys[li][0] + 2 * D
        dmg -= hs[ys[li - 1][1]]
    tr = max(0, hs[i] - dmg)
    hs[i] = tr
    dmg += tr
    r += tr
print(r)

-class Bit: -    def __init__(self, n): -        self.size = n -        self.tree = [0] * (n + 1) - -    def sum(self, i): -        s = 0 -        while i > 0: -            s += self.tree[i] -            i -= i & -i -        return s - -    def add(self, i, x): -        while i <= self.size: -            self.tree[i] += x -            i += i & -i - +from collections import deque -for _ in range(N): +hs = [] +for i in range(N): -    ys.append((2 * X, -(-H // A))) -    ys.append((2 * X + 4 * D + 1, -(-H // A))) +    ys.append((X, i)) +    hs.append(-(-H // A)) -d1 = dict() -d2 = dict() -ls = [] -c = 0 -hs = [0] -for i, (y, h) in enumerate(ys): -    if y % 2: -        d1[y - 1 - 4 * D] = c -    else: -        c += 1 -        d2[y] = c -        ls.append(y) -        hs.append(h) -lls = [] -for i in range(N): -    lls.append(d1[ls[i]] - d2[ls[i]] + 1) -X = Bit(N + 1) +l = ys[0][0] + 2 * D +li = 0 +dmg = 0 -for i in range(N): -    n = lls[i] -    x = hs[i + 1] + X.sum(i + 1) -    if x <= 0: -        continue -    r += x -    X.add(i + 1, -x) -    X.add(i + 1 + n, x) +for y, i in ys: +    while not l >= y: +        li += 1 +        l = ys[li][0] + 2 * D +        dmg -= hs[ys[li - 1][1]] +    tr = max(0, hs[i] - dmg) +    hs[i] = tr +    dmg += tr +    r += tr