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.

-----Sample Input-----
3 3 2
1 2
5 4
9 2

-----Sample Output-----
2

First, let us use a bomb at the coordinate 4 to decrease the first and second monsters' health by 2.
Then, use a bomb at the coordinate 6 to decrease the second and third monsters' health by 2.
Now, all the monsters' healths are 0.
We cannot make all the monsters' health drop to 0 or below with just one bomb.

Difficulty: MEDIUM

Solutions:
(n, d, a) = map(int, input().split())
xh = [list(map(int, input().split())) for _ in range(n)]
xh.sort(key=lambda x: x[0])
from collections import deque
minusd = deque()
nowd = 0
ans = 0
for (x, h) in xh:
	while minusd and minusd[0][1] <= x:
		(d_, _) = minusd.popleft()
		nowd -= d_
	tmp = max(0, (h - nowd + a - 1) // a)
	ans += tmp
	nowd += tmp * a
	minusd.append([tmp * a, x + 2 * d + 1])
print(ans)


f = lambda : map(int, input().split())
(n, d, a) = f()
lt = sorted((tuple(f()) for _ in range(n)))
from collections import *
q = deque()
c = s = 0
for (x, h) in lt:
	while q and q[0][0] < x:
		s += q.popleft()[1]
	h -= s
	if h > 0:
		t = -h // a
		c -= t
		s -= t * a
		q.append((x + d * 2, t * a))
print(c)


from bisect import bisect_left, bisect_right
(n, d, a) = map(int, input().split())
l = []
ans = 0
for i in range(n):
	(x, h) = map(int, input().split())
	l.append((x, -(-h // a)))
l.sort()
back = [-1]
rui = [0]
for (x, h) in l:
	i = bisect_left(back, x)
	h -= rui[-1] - rui[i - 1]
	if h <= 0:
		continue
	ans += h
	back.append(x + d * 2)
	rui.append(rui[-1] + h)
print(ans)


from collections import deque
(n, d, a) = map(int, input().split())
xh = sorted([list(map(int, input().split())) for _ in range(n)])
ans = 0
dam_sum = 0
q = deque()
for (i, (x, h)) in enumerate(xh):
	while q and q[0][0] < x:
		(ran, dam) = q.popleft()
		dam_sum -= dam
	h -= dam_sum
	if h <= 0:
		continue
	c = -(-h // a)
	ans += c
	dam_sum += c * a
	q.append((x + d * 2, c * a))
print(ans)


import sys
from collections import deque
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7

def resolve():
	(n, d, a) = list(map(int, input().split()))
	XH = sorted([list(map(int, input().split())) for _ in range(n)])
	res = 0
	tt_dmg = 0
	que = deque()
	for (x, h) in XH:
		while que and que[0][1] < x:
			(dmg, rng) = que.popleft()
			tt_dmg -= dmg
		if tt_dmg < h:
			h -= tt_dmg
			cnt = (h + a - 1) // a
			res += cnt
			dmg = cnt * a
			tt_dmg += dmg
			que.append((dmg, x + d * 2))
	print(res)

def __starting_point():
	resolve()
__starting_point()


(n, d, a) = list(map(int, input().split()))
enemies = [list(map(int, input().split())) for _ in range(n)]
enemies.sort(key=lambda a: a[0])
d *= 2
total_damage = 0
import collections
q = collections.deque()
ans = 0
for i in range(n):
	x = enemies[i][0]
	hp = enemies[i][1]
	while len(q) and q[0][0] < x:
		total_damage -= q[0][1]
		q.popleft()
	hp -= total_damage
	if hp > 0:
		times = (hp + a - 1) // a
		total_damage += a * times
		ans += times
		q.append((x + d, a * times))
print(ans)


import sys, heapq
input = sys.stdin.readline
(N, D, A) = [int(_) for _ in input().split()]
XH = [[int(_) for _ in input().split()] for _ in range(N)]
He = [[2 * x, h, 0] for (x, h) in XH]
heapq.heapify(He)
now = 0
ans = 0
while He:
	(x, h, t) = heapq.heappop(He)
	if t:
		now -= h
	elif h - A * now > 0:
		diff = (h - A * now - 1) // A + 1
		now += diff
		ans += diff
		heapq.heappush(He, [x + 4 * D + 1, diff, 1])
print(ans)


from math import ceil
from collections import deque
(N, D, A) = map(int, input().split())
XH = [list(map(int, input().split())) for _ in range(N)]
XH.sort(key=lambda x: x[0])
ans = 0
XN = [[x, ceil(h / A)] for (x, h) in XH]
cnum = 0
que = deque()
ans = 0
for (x, n) in XN:
	while que and x > que[0][0]:
		(_, num) = que.popleft()
		cnum -= num
	need = max(0, n - cnum)
	ans += need
	cnum += need
	if need:
		que.append([x + 2 * D, need])
print(ans)


from collections import deque
import math
import sys
input = sys.stdin.readline
(N, D, A) = list(map(int, input().split()))
S = [0] * N
atack = deque()
for i in range(N):
	(x, h) = list(map(int, input().split()))
	S[i] = [x, h]
S.sort()
cnt = 0
dmg = 0
for i in range(N):
	while atack:
		if atack[0][0] < S[i][0]:
			(x, d) = atack.popleft()
			dmg -= d
		else:
			break
	if S[i][1] <= dmg:
		continue
	bomb = math.ceil((S[i][1] - dmg) / A)
	atack.append([S[i][0] + 2 * D, A * bomb])
	cnt += bomb
	dmg += A * bomb
print(cnt)


import math
import collections
(N, D, A) = map(int, input().split())
XH = [tuple(map(int, input().split())) for i in range(N)]
XH.sort()
q = collections.deque()
c = 0
ans = 0
for (x, h) in XH:
	while q:
		if q[0][0] < x:
			t = q.popleft()
			c -= t[1]
		else:
			break
	h -= c * A
	k = math.ceil(max(h, 0) / A)
	ans += k
	c += k
	if k > 0:
		q.append((x + 2 * D, k))
print(ans)


from collections import deque
import math
(N, D, A) = list(map(int, input().split()))
XH = [list(map(int, input().split())) for _ in range(N)]
XH.sort(key=lambda x: x[0])
ans = 0
total_damage = 0
dq = deque()
for (x, h) in XH:
	while dq and dq[0][1] < x:
		(dmg, rng) = dq.popleft()
		total_damage -= dmg
	if total_damage < h:
		h -= total_damage
		cnt = math.ceil(h / A)
		ans += cnt
		dmg = cnt * A
		total_damage += dmg
		dq.append((dmg, x + D * 2))
print(ans)


import math
import sys
from collections import deque

def input():
	return sys.stdin.readline().strip()
sys.setrecursionlimit(20000000)
MOD = 10 ** 9 + 7
INF = float('inf')

def main():
	(N, D, A) = list(map(int, input().split()))
	monster = [list(map(int, input().split())) for _ in range(N)]
	monster.sort(key=lambda x: x[0])
	attack = []
	for i in range(N):
		attack.append(math.ceil(monster[i][1] / A))
	acc_damage = 0
	attacked = deque([])
	answer = 0
	for i in range(N):
		x = monster[i][0]
		h = attack[i]
		while attacked and x > attacked[0][0]:
			(limit, damage) = attacked.popleft()
			acc_damage -= damage
		need = max(0, h - acc_damage)
		answer += need
		acc_damage += need
		if need:
			attacked.append((x + 2 * D, need))
	print(answer)

def __starting_point():
	main()
__starting_point()


import sys
input = sys.stdin.readline
(n, d, a) = map(int, input().split())
H = [list(map(int, input().split())) for i in range(n)]
H.sort()
ans = 0
m = 0
M = []
t = 0
for i in range(n):
	while t < len(M) and M[t][1] < H[i][0]:
		m -= M[t][0]
		t += 1
	H[i][1] -= m
	if H[i][1] > 0:
		dn = -(-H[i][1] // a)
		dd = dn * a
		M.append([dd, H[i][0] + d * 2])
		ans += dn
		m += dd
print(ans)


from collections import deque
(n, d, a) = map(int, input().split())
p = [list(map(int, input().split())) for _ in range(n)]
p.sort()
d *= 2
(ans, tot) = (0, 0)
q = deque()
for (x, h) in p:
	while q and q[0][0] < x:
		tot -= q[0][1]
		q.popleft()
	h -= tot
	if h > 0:
		num = (h + a - 1) // a
		ans += num
		damage = num * a
		tot += damage
		q.append((x + d, damage))
print(ans)


import heapq
(n, d, a) = map(int, input().split())
bom = []
for _ in range(n):
	(x, h) = map(int, input().split())
	bom.append([x, h])
bom.sort(key=lambda x: x[0])
ans = 0
tot = 0
q = []
for (x, h) in bom:
	while q:
		if q[0][0] >= x:
			break
		else:
			(_, t) = heapq.heappop(q)
			tot -= t
	r = max((h - tot - 1) // a + 1, 0)
	ans += r
	tot += r * a
	heapq.heappush(q, (x + 2 * d, r * a))
print(ans)


import math
(N, D, A) = map(int, input().split())
d = []
for _ in range(N):
	(x, h) = map(int, input().split())
	d.append((x, h))
d.sort(key=lambda x: x[0])
now_damage = 0
from collections import deque
d = deque(d)
ans = 0
d_field = deque()
while d:
	x = d.popleft()
	(place, life) = x
	if d_field:
		while d_field and d_field[0][0] < place:
			now_damage -= A * d_field[0][1]
			d_field.popleft()
	if life <= now_damage:
		pass
	elif life > now_damage:
		K = math.ceil((life - now_damage) / A)
		ans += K
		now_damage += K * A
		d_field.append((2 * D + place, K))
print(ans)


from collections import deque
(n, d, a) = list(map(int, input().split()))
xh = [list(map(int, input().split())) for _ in range(n)]
xh.sort()
d = 2 * d
ans = 0
total = 0
q = deque()
for i in range(n):
	(x, h) = xh[i]
	while len(q) >= 1 and x > q[0][0]:
		total -= q.popleft()[1]
	h -= total
	if h > 0:
		num = (h - 1) // a + 1
		damage = a * num
		ans += num
		total += damage
		q.append([x + d, damage])
print(ans)


from math import ceil
from collections import deque
(N, D, A) = map(int, input().split())
Monsters = sorted([list(map(int, input().split())) for i in range(N)])
Monsters = [[x, ceil(h / A)] for (x, h) in Monsters]
acc_damage = 0
que = deque([])
ans = 0
for (x, h) in Monsters:
	while que and x > que[0][0]:
		(limit, damage) = que.popleft()
		acc_damage -= damage
	need = max(0, h - acc_damage)
	ans += need
	acc_damage += need
	if need:
		que.append([x + 2 * D, need])
print(ans)


from heapq import heappush, heappop
(n, d, a) = list(map(int, input().split()))
actions = []
for _ in range(n):
	(x, h) = list(map(int, input().split()))
	heappush(actions, (x, 0, (h + a - 1) // a))
cnt = 0
bomb = 0
current_bomb = 0
while cnt < n:
	(a, c, b) = heappop(actions)
	if c:
		current_bomb -= b
		continue
	else:
		HP = b
		if HP <= current_bomb:
			cnt += 1
			continue
		else:
			HP -= current_bomb
			cnt += 1
			current_bomb += HP
			bomb += HP
			heappush(actions, (a + 2 * d, 1, HP))
print(bomb)


(N, D, A) = map(int, input().split())
XH = sorted([list(map(int, input().split())) for _ in range(N)])
bombloc = [-1]
bombdam = [0]
nbomb = 1
ibomb = 0
damage = 0
ans = 0
for (x, h) in XH:
	while ibomb < nbomb and bombloc[ibomb] + D < x:
		damage -= bombdam[ibomb]
		ibomb += 1
	h_remain = h - damage
	if h_remain <= 0:
		continue
	n = (h_remain + A - 1) // A
	bombloc.append(x + D)
	bombdam.append(n * A)
	nbomb += 1
	damage += n * A
	ans += n
print(ans)


from collections import deque
(N, D, A) = map(int, input().split())
mons = []
for _ in range(N):
	(X, H) = map(int, input().split())
	mons.append((X, (H + A - 1) // A))
mons.sort()
ans = 0
q = deque([])
tot = 0
for (x, h) in mons:
	while q:
		(x0, h0) = next(iter(q))
		if x - 2 * D <= x0:
			break
		tot -= h0
		q.popleft()
	h = max(0, h - tot)
	ans += h
	tot += h
	q.append((x, h))
print(ans)


from collections import deque
(n, d, a) = map(int, input().split())
f = [list(map(int, input().split())) for i in range(n)]
queue = deque()
f.sort()
tot = 0
ans = 0
for i in range(n):
	x = f[i][0]
	h = f[i][1]
	while queue and queue[0][0] < x:
		now = queue.popleft()
		tot -= now[1]
	h -= tot
	if h > 0:
		num = (h + a - 1) // a
		ans += num
		damage = num * a
		tot += damage
		queue.append((x + 2 * d, damage))
print(ans)


from collections import deque
(n, d, a) = map(int, input().split())
mon = [tuple(map(int, input().split())) for i in range(n)]
mon.sort()
p = deque(mon)
baku = deque()
cou = 0
ans = 0
while p:
	(nowx, nowh) = p.popleft()
	while baku:
		(bx, bh) = baku.popleft()
		if bx >= nowx:
			baku.appendleft((bx, bh))
			break
		elif bx < nowx:
			cou -= bh
	if nowh <= cou:
		continue
	elif nowh > cou:
		k = -((-nowh + cou) // a)
		ans += k
		cou += a * k
		baku.append((nowx + 2 * d, a * k))
print(ans)


(n, d, a) = [int(s) for s in input().strip().split()]
(X, H) = ([0] * n, [0] * n)
for i in range(n):
	(X[i], H[i]) = [int(s) for s in input().strip().split()]
result = 0
monsters = sorted(zip(X, H))
q = []
ptr = 0
delta = 0
for (x, h) in monsters:
	while ptr < len(q) and q[ptr][0] < x:
		delta += q[ptr][1]
		ptr += 1
	h += delta
	if h <= 0:
		continue
	result += (h + a - 1) // a
	delta -= (h + a - 1) // a * a
	q.append((x + 2 * d, (h + a - 1) // a * a))
print(result)


import heapq
from math import ceil
(n, d, a) = map(int, input().split())
xh = [list(map(int, input().split())) for _ in range(n)]
xh.sort()
res = 0
b = []
heapq.heapify(b)
r = 0
for i in range(n):
	(x, h) = xh[i]
	while len(b) > 0 and b[0][0] <= x:
		r += b[0][1]
		heapq.heappop(b)
	c = max(ceil((h - r) / a), 0)
	res += c
	r += c * a
	if c > 0:
		heapq.heappush(b, (x + 2 * d + 1, -c * a))
print(res)


from collections import deque
(N, D, A) = map(int, input().split())
XH = [list(map(int, input().split())) for _ in range(N)]
XH.sort()
que = deque([])
ans = 0
total = 0
for i in range(N):
	(x, h) = XH[i]
	if h <= 0:
		continue
	while que and XH[i][0] > que[0][0]:
		(_, tmp) = que.popleft()
		total -= tmp
	h -= total
	if h > 0:
		atk = (h + A - 1) // A
		damage = atk * A
		ans += atk
		total += damage
		que.append((x + 2 * D, damage))
print(ans)


from collections import deque
import sys
input = sys.stdin.readline
(N, D, A) = map(int, input().split())
xh = [list(map(int, input().split())) for _ in range(N)]
xh = sorted(xh)
total = 0
D = 2 * D
ans = 0
q = deque()
for i in range(N):
	(x, h) = xh[i]
	while len(q) >= 1 and q[0][0] < x:
		total -= q.popleft()[1]
	h -= total
	if h > 0:
		num = (h - 1) // A + 1
		ans += num
		damage = num * A
		total += damage
		q += [[x + D, damage]]
print(ans)


import math
(n, d, a) = list(map(int, input().split()))
e = [[] for i in range(n)]
for i in range(n):
	(x, h) = list(map(int, input().split()))
	e[i] = [x, h]
num = 0
e.sort()
sd = [0 for i in range(n)]
l = [i for i in range(n)]
for i in range(n):
	for j in range(l[i - 1], i):
		if e[i][0] - e[j][0] <= 2 * d:
			l[i] = j
			break
for i in range(n):
	res = e[i][1] - sd[i - 1] + sd[l[i] - 1]
	if res < 0:
		sd[i] = sd[i - 1]
	else:
		k = math.ceil(res / a)
		sd[i] = sd[i - 1] + k * a
		num += k
print(num)


from collections import deque
(N, D, A) = map(int, input().split())
XH = [tuple(map(int, input().split())) for _ in range(N)]
XH.sort()
ans = 0
cnt = 0
que = deque()
for (x, h) in XH:
	while que and que[0][0] <= x:
		cnt -= que.popleft()[1]
	h -= cnt * A
	if h <= 0:
		continue
	ness = -(-h // A)
	cnt += ness
	ans += ness
	que.append((x + 2 * D + 1, ness))
print(ans)


import math
from collections import deque
(N, D, A) = map(int, input().split())
monsters = sorted([list(map(int, input().split())) for _ in range(N)])
monsters = [[x, math.ceil(h / A)] for (x, h) in monsters]
que = deque()
cur = 0
ans = 0
for (x, h) in monsters:
	while que and x > que[0][0]:
		(_, n) = que.popleft()
		cur -= n
	need = max(0, h - cur)
	ans += need
	cur += need
	if h:
		que.append([x + 2 * D, need])
print(ans)


import queue
import math
(n, d, a) = map(int, input().split())
xh = list((list(map(int, input().split())) for _ in range(n)))
xh.sort(key=lambda x: x[0])
d = d * 2
total = 0
q = queue.Queue()
ans = 0
for i in range(n):
	while not q.empty() and q.queue[0][0] < xh[i][0]:
		total -= q.queue[0][1]
		q.get()
	h = xh[i][1] - total
	if h > 0:
		c = math.ceil(h / a)
		ans += c
		damage = c * a
		total += damage
		q.put((xh[i][0] + d, damage))
print(ans)


import math
from collections import deque
(N, D, A) = map(int, input().split())
XH = [list(map(int, input().split())) for _ in range(N)]
XH = sorted(XH)
total = 0
D = 2 * D
ans = 0
q = deque()
for (x, h) in XH:
	while len(q) and q[0][0] < x:
		total -= q.popleft()[1]
	h -= total
	if h > 0:
		num = math.ceil(h / A)
		ans += num
		damage = num * A
		total += damage
		q += [[x + D, damage]]
print(ans)


from collections import deque
from math import ceil
(n, d, a) = map(int, input().split())
M = [list(map(int, input().split())) for i in range(n)]
M = [[x, ceil(h / a)] for (x, h) in M]
M = sorted(M)
que = deque()
ans = 0
atack = 0
for (x, h) in M:
	while len(que) > 0 and que[0][0] < x:
		(tx, ta) = que.popleft()
		atack -= ta
	bomb_num = max(0, h - atack)
	atack += bomb_num
	ans += bomb_num
	if bomb_num > 0:
		que.append([x + d * 2, bomb_num])
print(ans)


import sys
from collections import deque
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7

def resolve():
	(n, d, a) = list(map(int, input().split()))
	XH = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x: x[0])
	res = 0
	total = 0
	end = deque([])
	for i in range(n):
		(x, h) = XH[i]
		while end and end[0][0] < x:
			r = end.popleft()
			total -= r[1]
		if total < h:
			res += (h - total + a - 1) // a
			damage = (h - total + a - 1) // a * a
			total += damage
			end.append([x + 2 * d, damage])
	print(res)

def __starting_point():
	resolve()
__starting_point()


import math
import collections
(N, D, A) = map(int, input().split())
XH = [tuple(map(int, input().split())) for i in range(N)]
XH.sort()
q = collections.deque()
c = 0
ans = 0
for (x, h) in XH:
	while q and q[0][0] < x:
		c -= q[0][1]
		q.popleft()
	h -= c * A
	if h < 0:
		h = 0
	ans += math.ceil(h / A)
	c += math.ceil(h / A)
	q.append((x + 2 * D, math.ceil(h / A)))
print(ans)


from collections import deque
(n, d, a) = map(int, input().split())
ls = [list(map(int, input().split())) for i in range(n)]
ls.sort(key=lambda x: x[0])
q = deque()
ans = 0
tot = 0
for i in range(n):
	x = ls[i][0]
	h = ls[i][1]
	while q and q[0][0] < x:
		tot -= q[0][1]
		q.popleft()
	h -= tot
	if h > 0:
		num = (h + a - 1) // a
		ans += num
		tot += num * a
		q.append([x + 2 * d, num * a])
print(ans)


(N, D, A) = map(int, input().split())
XH = [list(map(int, input().split())) for _ in range(N)]
XH.sort()
B = 0
Bt = [0] * N
Bx = [0] * N
l = 0
r = -1
ans = 0
for i in range(N):
	(x, h) = XH[i]
	if h <= 0:
		continue
	while l <= r:
		if Bx[l] < x:
			B -= Bt[l] * A
			l += 1
		else:
			break
	h -= B
	if h > 0:
		t = (h + A - 1) // A
		ans += t
		r += 1
		Bt[r] = t
		Bx[r] = x + 2 * D
		B += A * t
print(ans)


from collections import deque
(N, D, A) = map(int, input().split())
X = []
for _ in range(N):
	(x, h) = map(int, input().split())
	X.append((x, h))
X = sorted(X)[::-1]
Q = deque([])
ans = 0
k = 0
while X:
	if len(Q) == 0 or X[-1][0] <= Q[0][0]:
		(x, h) = X.pop()
		h = max(h - k * A, 0)
		a = (h + A - 1) // A
		ans += a
		k += a
		deque.append(Q, (x + 2 * D, a))
	else:
		(x, a) = deque.popleft(Q)
		k -= a
print(ans)


(n, d, a) = map(int, input().split())
loans = []
bar = 0
ans = 0
xh = sorted([tuple(map(int, input().split())) for _ in range(n)])
for (x, h) in xh:
	while len(loans) > 0:
		(xx, dd) = loans[0]
		if xx < x:
			loans.pop(0)
			bar -= dd
		else:
			break
	h -= bar
	if h > 0:
		c = h // a if h % a == 0 else h // a + 1
		ans += c
		dd = c * a
		bar += dd
		loans.append((x + 2 * d, dd))
print(ans)


from collections import deque
import math
(n, d, a) = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(n)]
l.sort(key=lambda x: x[0])
cnt = 0
queue = deque()
sum_bomb = 0
for i in range(n):
	while len(queue) != 0 and queue[0][0] < l[i][0]:
		sum_bomb -= queue[0][1] * a
		queue.popleft()
	l[i][1] -= sum_bomb
	if l[i][1] <= 0:
		continue
	num = math.ceil(l[i][1] / a)
	right = l[i][0] + 2 * d
	queue.append([right, num])
	cnt += num
	sum_bomb += num * a
print(cnt)


from math import ceil
from collections import deque
(n, d, a) = map(int, input().split())
monster = [list(map(int, input().split())) for i in range(n)]
monster.sort()
damage = 0
finish = deque()
ans = 0
for i in range(n):
	(x, h) = monster[i]
	while finish:
		if finish[0][0] < x:
			damage -= finish.popleft()[1]
		else:
			break
	if h <= damage:
		continue
	else:
		b = ceil((h - damage) / a)
		ans += b
		damage += b * a
		finish.append([x + 2 * d, b * a])
print(ans)


from math import *
import sys
input = sys.stdin.readline

def main():
	(N, D, A) = list(map(int, input().split()))
	XH = sorted([list(map(int, input().split())) for i in range(N)])
	t = 0
	q = []
	ans = 0
	for (X, H) in XH:
		while q and q[0][0] < X - D:
			(x, c) = q.pop(0)
			t -= c
		H -= A * t
		if H <= 0:
			continue
		c = ceil(H / A)
		ans += c
		q.append((X + D, c))
		t += c
	print(ans)
main()


from math import *
from collections import *
(N, D, A) = list(map(int, input().split()))
ans = 0
t = 0
q = deque()
XH = sorted([list(map(int, input().split())) for i in range(N)])
for (x, h) in XH:
	if q:
		while q and q[0][0] < x - D:
			(_, c) = q.popleft()
			t -= c
	h = h - t * A
	if h <= 0:
		continue
	x += D
	c = ceil(h / A)
	t += c
	ans += c
	q.append((x, c))
print(ans)


from math import ceil
from collections import deque
(n, d, a) = map(int, input().split())
m = sorted([list(map(int, input().split())) for _ in range(n)])
m = [[x, ceil(h / a)] for (x, h) in m]
acc_damage = 0
que = deque()
ans = 0
for (x, h) in m:
	while que and x > que[0][0]:
		(limit, damage) = que.popleft()
		acc_damage -= damage
	need = max(0, h - acc_damage)
	ans += need
	acc_damage += need
	if need:
		que.append([x + 2 * d, need])
print(ans)


from collections import deque
(N, D, A) = map(int, input().split())
XH = [list(map(int, input().split())) for _ in range(N)]
XH.sort()
q = deque()
t = 0
result = 0
for (x, h) in XH:
	while q:
		if x <= q[0][0]:
			break
		t -= q[0][1]
		q.popleft()
	h -= t
	if h <= 0:
		continue
	c = (h + A - 1) // A
	result += c
	t += c * A
	q.append((x + 2 * D, c * A))
print(result)


import math
(N, D, A) = map(int, input().split())
XH = sorted((tuple(map(int, input().split())) for _ in range(N)))
Q = []
qIdx = 0
s = 0
t = 0
for (x, h) in XH:
	while qIdx < len(Q) and Q[qIdx][0] < x:
		s -= Q[qIdx][1]
		qIdx += 1
	if s < h:
		q = int(math.ceil((h - s) / A))
		Q.append((x + 2 * D, q * A))
		s += q * A
		t += q
print(t)


from collections import deque
(N, D, A) = map(int, input().split())
XH = []
for _ in range(N):
	(x, h) = map(int, input().split())
	XH.append((x, h))
XH.sort(key=lambda x: x[0])
D = 2 * D
tot = 0
q = deque()
ans = 0
for i in range(N):
	(x, h) = XH[i]
	while 0 < len(q) and q[0][0] < x:
		tot -= q[0][1]
		q.popleft()
	h -= tot
	if h > 0:
		num = (h + A - 1) // A
		ans += num
		damage = num * A
		tot += damage
		q.append((x + D, damage))
print(ans)


(N, D, A) = map(int, input().split())
XH = [list(map(int, input().split())) for _ in range(N)]
XH.sort()
q = []
t = 0
result = 0
for (x, h) in XH:
	while True:
		if len(q) == 0:
			break
		if x <= q[0][0]:
			break
		t -= q[0][1]
		q.pop(0)
	h -= t
	if h < 0:
		continue
	c = (h + A - 1) // A
	result += c
	t += c * A
	q.append((x + 2 * D, c * A))
print(result)


from collections import deque
(N, D, A) = list(map(int, input().split()))
pair_xh = [[-1, -1] for _ in range(N)]
for i in range(N):
	(pair_xh[i][0], pair_xh[i][1]) = list(map(int, input().split()))
pair_xh.sort(key=lambda x: x[0])
q_lim_d = deque()
total = 0
count = 0
for i in range(N):
	x = pair_xh[i][0]
	h = pair_xh[i][1]
	while len(q_lim_d) and q_lim_d[-1][0] < x:
		total -= q_lim_d[-1][1]
		q_lim_d.pop()
	h -= total
	if h > 0:
		times = (h + A - 1) // A
		count += times
		damage = A * times
		total += damage
		q_lim_d.appendleft([x + 2 * D, damage])
print(count)


(n, d, a) = [int(j) for j in input().split()]
xh = [[int(j) for j in input().split()] for i in range(n)]
xh.sort()
from collections import deque
q = deque()
ans = 0
dmg = 0
for (x, h) in xh:
	while q and q[0][0] < x:
		(i, j) = q.popleft()
		dmg -= j
	r = h - dmg
	if r <= 0:
		continue
	p = -(-r // a)
	dmg += p * a
	ans += p
	q.append((x + 2 * d, p * a))
print(ans)


from collections import *
INF = 10 ** 18
(n, d, a) = map(int, input().split())
mon = []
for _ in range(n):
	mon += [list(map(int, input().split()))]
mon.sort()
ans = 0
tot = 0
q = deque()
for i in range(n):
	(x, h) = mon[i]
	while q and q[0][0] < x:
		tot -= q.popleft()[1]
	h -= tot
	if h > 0:
		b = (h + a - 1) // a
		tot += b * a
		ans += b
		q.append((x + 2 * d, b * a))
print(ans)


(n, d, a) = map(int, input().split())
l = [[0, 0] for _ in range(n)]
for i in range(n):
	(x, h) = map(int, input().split())
	l[i][0] = x
	l[i][1] = h
l.sort()
from collections import deque
d = 2 * d
q = deque([])
total = 0
ans = 0
for i in range(n):
	x = l[i][0]
	h = l[i][1]
	if q:
		while q[0][0] < x:
			total -= q[0][1]
			q.popleft()
			if not q:
				break
	h -= total
	if h > 0:
		num = (h + a - 1) // a
		ans += num
		damage = num * a
		total += damage
		q.append([x + d, damage])
print(ans)


from collections import deque
(N, D, A) = map(int, input().split())
XH = [tuple(map(int, input().split())) for _ in range(N)]
XH = sorted(XH)
que = deque()
cum = 0
ans = 0
for i in range(N):
	(x, h) = XH[i]
	if i == 0:
		(r, n) = (x + 2 * D, (h + A - 1) // A)
		d = n * A
		cum += d
		que.append((r, d))
		ans += n
		continue
	while que and que[0][0] < x:
		(r, d) = que.popleft()
		cum -= d
	h -= cum
	if h < 0:
		continue
	(r, n) = (x + 2 * D, (h + A - 1) // A)
	d = n * A
	cum += d
	que.append((r, d))
	ans += n
print(ans)


from collections import deque
(n, d, a) = map(int, input().split())
XH = [list(map(int, input().split())) for _ in range(n)]
XH.sort()
XC = [[x, (h - 1) // a + 1] for (x, h) in XH]
q = deque([])
accum_dmg = 0
ans = 0
for (x, c) in XC:
	while q and x > q[0][0]:
		(_, dmg) = q.popleft()
		accum_dmg -= dmg
	cnt = max(0, c - accum_dmg)
	ans += cnt
	accum_dmg += cnt
	if cnt:
		q.append([x + 2 * d, cnt])
print(ans)


from collections import deque
(N, D, A) = map(int, input().split())
monsters = []
for _ in range(N):
	monsters.append(list(map(int, input().split())))
monsters.sort()
d = deque()
ans = 0
damage = 0
for (x, h) in monsters:
	while d:
		if d[0][0] >= x - D:
			break
		(_, power) = d.popleft()
		damage -= power
	h -= damage
	if h <= 0:
		continue
	attack = (h - 1) // A + 1
	ans += attack
	d.append((x + D, attack * A))
	damage += attack * A
print(ans)


from collections import deque
import math
(n, d, a) = map(int, input().split())
F = []
for _ in range(n):
	(x, h) = map(int, input().split())
	F.append((x, h))
F.sort()
total = 0
d *= 2
ans = 0
q = deque([])
for (x, h) in F:
	while q and q[0][0] < x:
		total -= q.popleft()[1]
	h -= total
	if h > 0:
		tmp = math.ceil(h / a)
		ans += tmp
		damage = tmp * a
		total += damage
		q.append((x + d, damage))
print(ans)


from collections import deque
(N, D, A) = map(int, input().split())
Monsters = [tuple(map(int, input().split())) for _ in range(N)]
Monsters.sort()
Attack = deque()
attack = 0
ans = 0
for (x, h) in Monsters:
	while Attack and Attack[0][0] <= x:
		(y, at) = Attack.popleft()
		attack -= at
	h -= attack
	num = max((h - 1) // A + 1, 0)
	attack += num * A
	ans += num
	Attack.append((x + 2 * D + 1, num * A))
print(ans)


(N, D, A) = map(int, input().split())
data = []
for _ in range(N):
	data.append(tuple(map(int, input().split())))
data.sort()
queue = []
i = 0
j = 0
total = 0
height = 0
while i < N:
	if j >= len(queue) or data[i][0] <= queue[j][0]:
		(x, h) = data[i]
		i += 1
		if height < h:
			count = (h - height + A - 1) // A
			total += count
			height += count * A
			queue.append((x + D * 2, count * A))
	else:
		height -= queue[j][1]
		j += 1
print(total)


from collections import deque
import math
(n, d, a) = map(int, input().split())
data = []
for i in range(n):
	data.append(list(map(int, input().split())))
data.sort()
dam = 0
ans = 0
q = deque()
for i in range(n):
	(x, h) = data[i]
	while q:
		k = q.popleft()
		if k[1] >= x:
			q.appendleft(k)
			break
		else:
			dam -= k[0]
	h -= dam
	h = max(h, 0)
	count = math.ceil(h / a)
	dam += count * a
	q.append([count * a, x + 2 * d])
	ans += count
print(ans)


from collections import deque
from math import ceil
(n, d, a) = list(map(int, input().split()))
ms = [list(map(int, input().split())) for i in range(n)]
ms = sorted([(pos, ceil(hp / a)) for (pos, hp) in ms])
bombs = deque()
ans = 0
valid_bomb = 0
for (pos, hp) in ms:
	while bombs and bombs[0][0] < pos:
		(bomb_border, bomb_cnt) = bombs.popleft()
		valid_bomb -= bomb_cnt
	bomb_cnt = max(0, hp - valid_bomb)
	valid_bomb += bomb_cnt
	ans += bomb_cnt
	if bomb_cnt > 0:
		bombs.append([pos + d * 2, bomb_cnt])
print(ans)


from math import ceil
from collections import deque
(n, d, a) = map(int, input().split())
m = [list(map(int, input().split())) for _ in range(n)]
m.sort()
l = [(x, ceil(h / a)) for (x, h) in m]
ans = 0
damage = 0
que = deque([])
for (x, h) in l:
	while que and que[0][0] < x:
		(s, t) = que.popleft()
		damage -= t
	need = max(0, h - damage)
	ans += need
	damage += need
	if need:
		que.append((x + 2 * d, need))
print(ans)


from math import ceil
from collections import deque
(N, D, H) = map(int, input().split())
Monsters = sorted([list(map(int, input().split())) for i in range(N)])
Monsters = [[x, ceil(h / H)] for (x, h) in Monsters]
ans = 0
acc = 0
deq = deque([])
for (x, h) in Monsters:
	while deq and x > deq[0][0]:
		(lim, dam) = deq.popleft()
		acc -= dam
	c = max(0, h - acc)
	ans += c
	acc += c
	if c:
		deq += [(x + 2 * D, c)]
print(ans)


from collections import deque
(N, D, A) = map(int, input().split())
ls = []
for i in range(N):
	(x, h) = map(int, input().split())
	h = h // A if h % A == 0 else h // A + 1
	ls += [(x, h)]
ls.sort(key=lambda x: x[0])
deq = deque([])
ans = 0
acc = 0
for i in range(N):
	(x, h) = ls[i]
	while deq and deq[0][0] < x:
		(y, d) = deq.popleft()
		acc -= d
	n = max(0, h - acc)
	ans += n
	acc += n
	if n:
		deq += [(x + 2 * D, n)]
print(ans)


(n, d, a) = map(int, input().split())
D = True
pos = []
pos1 = []
for i in range(n):
	(x, h) = map(int, input().split())
	pos.append((x, h))
pos.sort(key=lambda x: x[0])
bombs = 0
damage = 0
(y, z) = (0, 0)
while y < n:
	x0 = pos[y][0]
	try:
		x1 = pos1[z][0]
	except IndexError:
		x1 = 1e+16
	if x0 <= x1:
		health = pos[y][1]
		health -= damage
		number = max(0, (health - 1) // a + 1)
		bombs += number
		damage += number * a
		pos1.append((x0 + 2 * d, number * a))
		y += 1
	else:
		damage -= pos1[z][1]
		z += 1
print(bombs)


def resolve():
	(N, D, A) = list(map(int, input().split()))
	AB = [list(map(int, input().split())) for _ in range(N)]
	AB.sort()
	imos = [0] * (N + 1)
	ans = 0
	R = 0
	for l in range(N):
		if l:
			imos[l] += imos[l - 1]
		x = AB[l][0]
		h = AB[l][1]
		if imos[l] < h:
			R = max(R, l + 1)
			while R < N and AB[R][0] <= 2 * D + x:
				R += 1
			d = h - imos[l]
			cnt = (d + A - 1) // A
			imos[l] += cnt * A
			imos[R] -= cnt * A
			ans += cnt
	print(ans)

def __starting_point():
	resolve()
__starting_point()


from math import ceil, floor, factorial, gcd, sqrt, log2, cos, sin, tan, acos, asin, atan, degrees, radians, pi, inf
from itertools import accumulate, groupby, permutations, combinations, product, combinations_with_replacement
from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect_right
from operator import itemgetter
from heapq import heapify, heappop, heappush
from queue import Queue, LifoQueue, PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce, lru_cache
import string
import sys
sys.setrecursionlimit(10 ** 7)

def input():
	return sys.stdin.readline().strip()

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def MAP1():
	return map(lambda x: int(x) - 1, input().split())

def LIST():
	return list(MAP())

def LIST1():
	return list(MAP1())

def is_ok(arg):
	return h[arg][0] <= h[i][0] + d * 2

def meguru_bisect(ng, ok):
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if is_ok(mid):
			ok = mid
		else:
			ng = mid
	return ok
(n, d, a) = MAP()
h = [LIST() + [0] for i in range(n)]
h = sorted(h, key=itemgetter(0))
attack = 0
ans = 0
for i in range(n):
	bomb = ceil((h[i][1] - attack) / a)
	if bomb > 0:
		j = min(meguru_bisect(n, i), n - 1)
		h[j][2] -= bomb
		attack += bomb * a
		ans += bomb
	attack += h[i][2] * a
print(ans)


import heapq as hq
(N, D, A) = map(int, input().split())
m = []
for i in range(N):
	hq.heappush(m, tuple(map(int, input().split())))
ans = 0
dmg = 0
d = []
while m:
	(X, H) = m[0]
	if not d or X <= d[0][0]:
		if dmg < H:
			k = (H - dmg + A - 1) // A
			ans += k
			dmg += k * A
			hq.heappush(d, (X + 2 * D, -k * A))
		hq.heappop(m)
	else:
		dmg += d[0][1]
		hq.heappop(d)
print(ans)


from collections import deque
(n, d, a) = map(int, input().split())
xh = [list(map(int, input().split())) for i in range(n)]
xh.sort()
que = deque()
ans = 0
atk = 0
for (x, h) in xh:
	while que and que[0][0] <= x:
		atk -= que.popleft()[1]
	h -= a * atk
	if h <= 0:
		continue
	count = -(-h // a)
	ans += count
	atk += count
	que.append((x + 2 * d + 1, count))
print(ans)


from math import ceil
from collections import deque
(N, D, A) = map(int, input().split())
monsters = sorted([list(map(int, input().split())) for _ in range(N)])
q = deque([])
s = 0
ans = 0
for i in range(N):
	while len(q) > 0 and q[0][0] < monsters[i][0]:
		s -= q[0][1]
		q.popleft()
	h = monsters[i][1] - s * A
	if h > 0:
		num_bombs = ceil(h / A)
		q.append((monsters[i][0] + 2 * D, num_bombs))
		s += num_bombs
		ans += num_bombs
print(ans)


from collections import deque

def inpl():
	return list(map(int, input().split()))
(N, D, A) = inpl()
XH = [inpl() for i in range(N)]
XH.sort()
bomb = [(h + A - 1) // A for (x, h) in XH]
ans = 0
dq = deque()
s_i = 0
sum_q = 0
for i in range(N):
	while dq and dq[0][1] < XH[i][0]:
		(b, _) = dq.popleft()
		sum_q -= b
	bomb[i] -= sum_q
	if bomb[i] <= 0:
		pass
	else:
		ans += bomb[i]
		sum_q += bomb[i]
		dq.append([bomb[i], XH[i][0] + 2 * D])
print(ans)


(n, d, a) = map(int, input().split())
xh = [list(map(int, input().split())) for _ in range(n)]
xh.sort()
import collections
pq = collections.deque()
ans = 0
totalDamage = 0
for i in range(n):
	(x, h) = xh[i]
	while len(pq) > 0 and pq[0][0] < x:
		totalDamage -= pq[0][1]
		pq.popleft()
	h -= totalDamage
	if h <= 0:
		continue
	num = (h + a - 1) // a
	ans += num
	dam = num * a
	totalDamage += dam
	pq.append((x + 2 * d, dam))
print(ans)


(n, d, a) = map(int, input().split())
xh = sorted([list(map(int, input().split())) for _ in range(n)])
ret = 0
surface = 0
dec = []
j = 0
for i in range(n):
	(x, h) = xh[i]
	while j < len(dec) and dec[j][0] < x:
		surface -= dec[j][1]
		j += 1
	h = (h + a - 1) // a - surface
	if h > 0:
		dec.append((x + 2 * d, h))
		ret += h
		surface += h
print(ret)


import math
(n, d, a) = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(n)]
l.sort()
q = []
index = 0
ans = 0
dmg = 0
for i in range(n):
	while index < len(q) and q[index][0] < l[i][0]:
		dmg -= q[index][1]
		index += 1
	if l[i][1] > dmg:
		times = (l[i][1] - dmg) // a if (l[i][1] - dmg) % a == 0 else (l[i][1] - dmg) // a + 1
		ans += times
		q.append((l[i][0] + 2 * d, a * times))
		dmg += a * times
print(ans)


from bisect import bisect_left, bisect_right
import sys
input = sys.stdin.readline

def solve():

	def makeBIT(numEle):
		numPow2 = 2 ** (numEle - 1).bit_length()
		data = [0] * (numPow2 + 1)
		return (data, numPow2)

	def setInit(As):
		for (iB, A) in enumerate(As, 1):
			data[iB] = A
		for iB in range(1, numPow2):
			i = iB + (iB & -iB)
			data[iB] -= data[i]

	def addValue(iA, A):
		iB = iA + 1
		while iB > 0:
			data[iB] += A
			iB -= iB & -iB

	def getValue(iA):
		iB = iA + 1
		ans = 0
		while iB <= numPow2:
			ans += data[iB]
			iB += iB & -iB
		return ans
	(N, D, A) = list(map(int, input().split()))
	XHs = [tuple(map(int, input().split())) for _ in range(N)]
	XHs.sort()
	(Xs, Hs) = ([], [])
	for (X, H) in XHs:
		Xs.append(X)
		Hs.append(H)
	(data, numPow2) = makeBIT(N)
	setInit(Hs)
	ans = 0
	for i in range(N):
		rest = getValue(i)
		if rest <= 0:
			continue
		pos = Xs[i] + D
		iR = bisect_right(Xs, pos + D) - 1
		num = -(-rest // A)
		ans += num
		damage = num * A
		addValue(iR, -damage)
	print(ans)
solve()


from collections import deque
(n, d, a) = list(map(int, input().split()))
mons = []
for i in range(n):
	(x, h) = list(map(int, input().split()))
	mons.append((x, h))
mons = sorted(mons)
q = deque()
dm_sum = 0
ans = 0
for i in range(n):
	while dm_sum > 0:
		if q[0][0] < mons[i][0]:
			cur = q.popleft()
			dm_sum -= cur[1]
		else:
			break
	if mons[i][1] <= dm_sum:
		continue
	rem = mons[i][1] - dm_sum
	at_num = rem // a
	if rem % a != 0:
		at_num += 1
	ans += at_num
	q.append((mons[i][0] + 2 * d, at_num * a))
	dm_sum += at_num * a
print(ans)


from collections import deque
from math import ceil
(n, d, a) = map(int, input().split())
xh = sorted([list(map(int, input().split())) for _ in range(n)])
q = deque()
ans = 0
count = 0
total = 0
for (x, h) in xh:
	while q:
		if q[0][0] < x:
			total -= q.popleft()[1]
		else:
			break
	if total < ceil(h / a):
		count = ceil(h / a) - total
		ans += count
		total += count
		q.append((x + 2 * d, count))
print(ans)


from collections import deque
(n, d, a) = map(int, input().split())
(c, cc) = (0, 0)
deq = deque()
dl = [tuple(map(int, input().split())) for i in range(n)]
dl.sort()
for i in dl:
	(x, h) = i
	while deq:
		if deq[0][0] < x - 2 * d:
			cc -= deq.popleft()[1]
		else:
			break
	h -= a * cc
	if h > 0:
		c += (h - 1) // a + 1
		cc += (h - 1) // a + 1
		deq.append((x, (h - 1) // a + 1))
print(c)


def main():
	import sys
	from heapq import heappush, heappop, heapify
	input = sys.stdin.readline
	(N, D, A) = map(int, input().split())
	hq = []
	for i in range(N):
		(x, h) = map(int, input().split())
		hq.append((x, 0, h))
	heapify(hq)
	ans = 0
	b = 0
	while len(hq) > 0:
		(x, a, h) = heappop(hq)
		if a == 0:
			if b < h:
				cnt = (h - b + A - 1) // A
				ans += cnt
				b += A * cnt
				heappush(hq, (x + 2 * D, 1, A * cnt))
		else:
			b -= h
	print(ans)
main()


from collections import deque
(N, D, A) = map(int, input().split())
M = [tuple(map(int, input().split())) for i in range(N)]
M.sort()
X = [M[i][0] for i in range(N)]
H = [M[i][1] for i in range(N)]
ans = 0
diff = 0
q = deque()
for i in range(N):
	(Xi, Hi) = M[i]
	while len(q) > 0 and q[0][0] < Xi:
		diff += q.popleft()[1]
	Hi += diff
	if Hi <= 0:
		continue
	c = (Hi + A - 1) // A
	ans += c
	diff -= A * c
	q.append((Xi + 2 * D, A * c))
print(ans)


import sys
input = sys.stdin.readline
from heapq import heappush, heappop
(N, D, A) = map(int, input().split())
XH = [[int(i) for i in input().split()] for _ in range(N)]
XH.sort()
ret = 0
hp = []
s = 0
for (i, (x, h)) in enumerate(XH):
	while len(hp) > 0 and hp[0][0] < x - D:
		s -= heappop(hp)[1]
	if s > h:
		continue
	cnt = (h - s + A - 1) // A
	ret += cnt
	heappush(hp, (x + D, cnt * A))
	s += cnt * A
print(ret)


(N, D, A) = map(int, input().split())
XH = [tuple(map(int, input().split())) for i in range(N)]
XH.sort()
from collections import deque
q = deque()
ans = dmg = 0
for (x, h) in XH:
	while q and q[0][0] < x:
		(_, d) = q.popleft()
		dmg -= d
	rem = h - dmg
	if rem <= 0:
		continue
	a = -(-rem // A)
	ans += a
	dmg += a * A
	q.append((x + 2 * D, a * A))
print(ans)


import heapq
from collections import deque
(n, d, a) = map(int, input().split())
monster = []
for _ in range(n):
	(x, h) = map(int, input().split())
	heapq.heappush(monster, (x, h))
bomb = 0
damage = 0
queue = deque()
while monster:
	(x, h) = heapq.heappop(monster)
	while True:
		if queue and x > queue[0][0]:
			damage -= queue.popleft()[1]
		else:
			break
	h -= damage
	if h <= 0:
		continue
	b = (h - 1) // a + 1
	bomb += b
	queue.append((x + 2 * d, a * b))
	damage += a * b
print(bomb)


(N, D, A) = map(int, input().split())
X = [0] * N
for i in range(N):
	(x, h) = map(int, input().split())
	X[i] = (x, h)
X = sorted(X)
from collections import deque
q = deque()
ans = 0
total = 0
for i in range(N):
	(x, h) = X[i]
	while len(q) > 0 and q[0][0] < x:
		total -= q[0][1]
		q.popleft()
	h -= total
	if h > 0:
		num = (h + A - 1) // A
		ans += num
		damage = num * A
		total += damage
		q.append((x + 2 * D, damage))
print(ans)


import collections
(N, D, A) = [int(i) for i in input().split()]
XH = [tuple(map(int, input().split())) for _ in range(N)]
XH.sort()
queue = collections.deque()
ans = 0
damage = 0
for (x, h) in XH:
	while queue and queue[0][0] < x:
		damage -= queue.popleft()[1]
	h -= damage
	if h > 0:
		count = -(-h // A)
		ans += count
		queue.append((x + 2 * D, count * A))
		damage += count * A
print(ans)


import sys
from collections import deque
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
(N, D, A) = map(int, input().split())
XH = list((tuple(map(int, input().split())) for _ in range(N)))
XH.sort()
ans = 0
memo = deque()
cnt = 0
for (x, h) in XH:
	while memo and memo[0][0] < x:
		(_, i) = memo.popleft()
		cnt -= i
	h -= cnt * A
	h = max(h, 0)
	bomb = (h + A - 1) // A
	ans += bomb
	cnt += bomb
	memo.append((x + 2 * D, bomb))
print(ans)


import math
(N, D, A) = map(int, input().split())
M = []
for i in range(N):
	(X, H) = map(int, input().split())
	M.append((X, H))
M.sort(key=lambda x: x[0])
d = []
i = 0
ans = 0
B = 0
for (X, H) in M:
	while i != len(d) and X > d[i][0]:
		B -= d[i][1]
		i += 1
	if H > B:
		t = math.ceil((H - B) / A)
		ans += t
		B += t * A
		d.append((X + 2 * D, t * A))
print(ans)


from collections import deque
(N, D, A) = map(int, input().split())
XH = [list(map(int, input().split())) for i in range(N)]
XH.sort(key=lambda x: x[0])
q = deque()
s = 0
ans = 0
for i in range(N):
	x = XH[i][0]
	h = XH[i][1]
	while len(q) > 0:
		elm = q.popleft()
		if x <= elm[0]:
			q.appendleft(elm)
			break
		else:
			s -= elm[1]
	h -= s
	c = max(0, (h + A - 1) // A)
	ans += c
	s += c * A
	q.append((x + 2 * D, c * A))
print(ans)


from collections import deque
(N, D, A) = map(int, input().split())
XH = [list(map(int, input().split())) for _ in range(N)]
XH.sort(key=lambda x: x[0])
total = 0
q = deque()
ans = 0
for i in range(N):
	(X, H) = XH[i]
	while len(q) and q[0][0] < X:
		total -= q.popleft()[1]
	H -= total
	if H > 0:
		attack_cnt = (H - 1) // A + 1
		ans += attack_cnt
		damage = attack_cnt * A
		total += damage
		q.append([X + 2 * D, damage])
print(ans)


def prime_numbers(x):
	if x < 2:
		return []
	prime_numbers = [i for i in range(x)]
	prime_numbers[1] = 0
	for prime_number in prime_numbers:
		if prime_number > math.sqrt(x):
			break
		if prime_number == 0:
			continue
		for composite_number in range(2 * prime_number, x, prime_number):
			prime_numbers[composite_number] = 0
	return [prime_number for prime_number in prime_numbers if prime_number != 0]

def is_prime(x):
	if x < 2:
		return False
	if x == 2 or x == 3 or x == 5:
		return True
	if x % 2 == 0 or x % 3 == 0 or x % 5 == 0:
		return False
	prime_number = 7
	difference = 4
	while prime_number <= math.sqrt(x):
		if x % prime_number == 0:
			return False
		prime_number += difference
		difference = 6 - difference
	return True
from collections import deque
(n, d, a) = map(int, input().split())
xh = [list(map(int, input().split())) for i in range(n)]
xh.sort()
queue = deque()
ans = 0
cur = 0
for i in range(n):
	(x, h) = xh[i]
	while queue != deque() and queue[0][0] < x:
		cur -= queue.popleft()[1]
	h -= cur
	if h > 0:
		cur += a * ((h - 1) // a + 1)
		ans += (h - 1) // a + 1
		queue.append([x + 2 * d, a * ((h - 1) // a + 1)])
print(ans)


from collections import deque
import math
(N, D, A) = map(int, input().split())
monster = [list(map(int, input().split())) for _ in range(N)]
monster.sort(key=lambda x: x[0])
bomb = deque()
s = 0
ans = 0
for i in range(N):
	(x, h) = monster[i]
	while len(bomb) > 0 and bomb[0][1] < x:
		s -= bomb.popleft()[2]
	h -= s
	if h > 0:
		cnt = math.ceil(h / A)
		damage = cnt * A
		bomb.append([x, x + 2 * D, damage])
		s += damage
		ans += cnt
print(ans)


from sys import stdin
from collections import deque

def main():
	readline = stdin.readline
	(n, d, a) = map(int, readline().split())
	xh = [list(map(int, readline().split())) for _ in range(n)]
	xh.sort()
	x = [0] * n
	h = [0] * n
	for i in range(n):
		(x[i], h[i]) = (xh[i][0], xh[i][1])
	dq = deque()
	now = 0
	cnt = 0
	for i in range(n):
		if i == 0:
			cnt += (h[i] + a - 1) // a
			now += (h[i] + a - 1) // a * a
			dq.append([x[i] + 2 * d, now])
		else:
			while len(dq) != 0 and dq[0][0] < x[i]:
				tmp = dq.popleft()
				now -= tmp[1]
			if h[i] <= now:
				pass
			else:
				dq.append([x[i] + 2 * d, (h[i] - now + a - 1) // a * a])
				cnt += (h[i] - now + a - 1) // a
				now += (h[i] - now + a - 1) // a * a
	print(cnt)

def __starting_point():
	main()
__starting_point()


from collections import deque
(n, d, a) = map(int, input().split())
hit = []
for i in range(n):
	(x, h) = map(int, input().split())
	hit.append([x, h])
hit.sort()
que = []
ans = 0
bomb = 0
for i in range(n):
	while True:
		if len(que) == 0:
			break
		if hit[i][0] <= que[0][0]:
			break
		bomb -= que[0][1]
		que.pop(0)
	r = hit[i][1] - bomb
	if r < 0:
		continue
	c = (r + a - 1) // a
	ans += c
	bomb += c * a
	que.append((hit[i][0] + 2 * d, c * a))
print(ans)


import math
from collections import deque
(n, d, a) = list(map(int, input().split()))
xh = [list(map(int, input().split())) for _ in range(n)]
xh.sort(key=lambda x: x[0])
xh = deque(xh)
xh_field = deque()
cnt = 0
now_damage = 0
while xh:
	(pos, hp) = xh.popleft()
	if xh_field:
		while xh_field and xh_field[0][0] < pos:
			now_damage -= a * xh_field[0][1]
			xh_field.popleft()
	if hp <= now_damage:
		pass
	elif hp > now_damage:
		atk_cnt = math.ceil((hp - now_damage) / a)
		cnt += atk_cnt
		now_damage += atk_cnt * a
		xh_field.append((2 * d + pos, atk_cnt))
print(cnt)


(N, D, A) = map(int, input().split())
XH = [tuple(map(int, input().split())) for _ in range(N)]
XH.sort()
ans = 0
bomb_effect = 0
bomb_i = 0
bombs = []
for (x, h) in XH:
	while bomb_i < len(bombs) and x > bombs[bomb_i][0]:
		bomb_effect -= bombs[bomb_i][1] * A
		bomb_i += 1
	tairyoku = h - bomb_effect
	if tairyoku > 0:
		new_bomb = -(-tairyoku // A)
		ans += new_bomb
		bombs.append((x + 2 * D + 0.5, new_bomb))
		bomb_effect += new_bomb * A
print(ans)


from bisect import bisect_left as bl
(n, d, a) = map(int, input().split())
s = sorted([list(map(int, input().split())) for i in range(n)])
c = 0
p = [0]
q = [0]
for i in range(n):
	g = bl(q, s[i][0])
	s[i][1] -= a * (p[-1] - p[g - 1])
	if s[i][1] > 0:
		t = (s[i][1] - 1) // a + 1
		c += t
		p.append(p[-1] + t)
		q.append(s[i][0] + 2 * d)
print(c)