Vanya smashes potato in a vertical food processor. At each moment of time the height of the potato in the processor doesn't exceed h and the processor smashes k centimeters of potato each second. If there are less than k centimeters remaining, than during this second processor smashes all the remaining potato.

Vanya has n pieces of potato, the height of the i-th piece is equal to a_{i}. He puts them in the food processor one by one starting from the piece number 1 and finishing with piece number n. Formally, each second the following happens:

  If there is at least one piece of potato remaining, Vanya puts them in the processor one by one, until there is not enough space for the next piece.  Processor smashes k centimeters of potato (or just everything that is inside). 

Provided the information about the parameter of the food processor and the size of each potato in a row, compute how long will it take for all the potato to become smashed.


-----Input-----

The first line of the input contains integers n, h and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ h ≤ 10^9) — the number of pieces of potato, the height of the food processor and the amount of potato being smashed each second, respectively.

The second line contains n integers a_{i} (1 ≤ a_{i} ≤ h) — the heights of the pieces.


-----Output-----

Print a single integer — the number of seconds required to smash all the potatoes following the process described in the problem statement.


-----Examples-----
Input
5 6 3
5 4 3 2 1

Output
5

Input
5 6 3
5 5 5 5 5

Output
10

Input
5 6 3
1 2 1 1 1

Output
2



-----Note-----

Consider the first sample.   First Vanya puts the piece of potato of height 5 into processor. At the end of the second there is only amount of height 2 remaining inside.  Now Vanya puts the piece of potato of height 4. At the end of the second there is amount of height 3 remaining.  Vanya puts the piece of height 3 inside and again there are only 3 centimeters remaining at the end of this second.  Vanya finally puts the pieces of height 2 and 1 inside. At the end of the second the height of potato in the processor is equal to 3.  During this second processor finally smashes all the remaining potato and the process finishes. 

In the second sample, Vanya puts the piece of height 5 inside and waits for 2 seconds while it is completely smashed. Then he repeats the same process for 4 other pieces. The total time is equal to 2·5 = 10 seconds.

In the third sample, Vanya simply puts all the potato inside the processor and waits 2 seconds.

Difficulty: MEDIUM

Solutions:
import sys
input = sys.stdin.readline

def main():
	(n, h, k) = map(int, input().split())
	l = list(map(int, input().split()))
	ret = 0
	rem = 0
	for a in l:
		ret += rem // k
		rem %= k
		if rem + a <= h:
			rem += a
		else:
			ret += 1
			rem = a
	ret += (rem + k - 1) // k
	print(ret)
main()


from math import ceil

def readline():
	return [int(c) for c in input().split()]

def main():
	(_n, h, k) = readline()
	a = readline()
	ans = 0
	stack = a[::-1]
	processor = 0
	while stack:
		while stack and processor + stack[-1] <= h:
			processor += stack.pop()
		processor -= min(processor, k)
		ans += 1
		if stack and processor + stack[-1] > h:
			diff = processor + stack[-1] - h
			rem = ceil(diff / k)
			ans += rem
			processor -= min(processor, rem * k)
	ans += ceil(processor / k)
	print(ans)
main()


(n, h, k) = list(map(int, input().split()))
xs = list(map(int, input().split())) + [h + 1]
t = 0
x = 0
i = 0
while i + 1 < len(xs) or x > 0:
	while x + xs[i] <= h:
		x += xs[i]
		i += 1
	d = max(1, min(x, x - h + xs[i] + k - 1) // k)
	x = max(0, x - d * k)
	t += d
print(t)


(n, mxH, k) = map(int, input().split())
arr = list(map(int, input().split()))
(currT, currH, res) = (0, 0, 0)
i = 0
while i < len(arr):
	while i < len(arr) and currH + arr[i] <= mxH:
		currH += arr[i]
		i += 1
	if i < len(arr):
		currT = (currH + arr[i] - mxH + k - 1) // k
	else:
		currT = (currH + k - 1) // k
	currH = max(currH - currT * k, 0)
	res += currT
print(res)


from sys import stdin
SAMPLE = '5 6 3\n5 4 3 2 1\n'

def solve():
	i = 0
	machine = 0
	clock = 0
	while i < N or machine != 0:
		while i < N:
			item = DATA[i]
			if machine + item <= H:
				machine += item
				i += 1
			else:
				break
		(seconds, remainder) = (int(machine / K), machine % K)
		machine = remainder
		if seconds == 0 and machine != 0:
			clock += 1
			machine = 0
		else:
			clock += seconds
	print(clock)

def parse():
	global N, H, K, DATA
	pass
	line = stdin.readline().split()
	(N, H, K) = map(int, line)
	line = stdin.readline().split()
	DATA = [-1 for x in range(N)]
	for i in range(N):
		DATA[i] = int(line[i])
	solve()
parse()


(n, h, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
left = 0
for i in range(n - 1):
	total = left + a[i]
	if total < k:
		if total + a[i + 1] > h:
			ans += 1
			left = 0
		else:
			left += a[i]
	elif total <= h:
		ans += total // k
		left = total % k
		if left + a[i + 1] <= h:
			continue
		else:
			ans += 1
			left = 0
ans += (left + a[n - 1]) // k
left = (left + a[n - 1]) % k
if left:
	ans += 1
print(ans)


(n, h, k) = map(int, input().split())
c = ans = 0
for a in map(int, input().split()):
	if c + a > h:
		ans += c // k
		c %= k
		if c + a > h:
			ans += 1
			c = 0
	c += a
print(ans + (c + k - 1) // k)


import math
(n, h, k) = map(int, input().split())
heights = list(map(int, input().split()))
time = 0
r = 0
i = 0
while i < n:
	while i < n and h - r >= heights[i]:
		r += heights[i]
		i += 1
	if i < n:
		a = math.ceil((heights[i] - (h - r)) / k)
		r -= a * k
		time += a
		if r < 0:
			r = 0
time += math.ceil(r / k)
print(time)


(n, h, k) = map(int, input().split())
a = list(map(int, input().split()))
currentVolume = 0
i = 0
seconds = 0
while i < n:
	while i < n and currentVolume + a[i] <= h:
		currentVolume += a[i]
		i += 1
	if i == n:
		currentVolume -= k
		seconds += 1
	else:
		freeSpace = h - currentVolume
		if (a[i] - freeSpace) % k == 0:
			seconds += (a[i] - freeSpace) // k
			currentVolume -= a[i] - freeSpace
		else:
			seconds += (a[i] - freeSpace) // k + 1
			currentVolume -= k * ((a[i] - freeSpace) // k + 1)
	if currentVolume < 0:
		currentVolume = 0
if currentVolume == 0:
	print(seconds)
elif currentVolume % k == 0:
	print(seconds + currentVolume // k)
else:
	print(seconds + currentVolume // k + 1)


(n, h, k) = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ans = 0
rem = 0
i = 0
while i < n:
	while rem <= h and i < n:
		rem += A[i]
		i += 1
	if rem > h:
		i -= 1
		rem -= A[i]
	ans += rem // k
	rem %= k
	if i < n and rem + A[i] > h:
		ans += 1
		rem = 0
if rem > 0:
	ans += 1
print(ans)


import math
(n, h, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
current_height = 0
seconds_past = 0
i = 0
while i < len(a):
	if current_height + a[i] <= h:
		current_height += a[i]
		i += 1
	elif current_height <= k:
		current_height = 0
		seconds_past += 1
	else:
		seconds_past += current_height // k
		current_height = current_height % k
seconds_past += math.ceil(current_height / k)
print(seconds_past)


(n, h, k) = list(map(int, input().split()))
ip = list(map(int, input().split()))
time = 0
count = 0
height = 0
while count < n:
	if height + ip[count] <= h:
		height += ip[count]
		count += 1
	elif height % k == 0:
		time += height // k
		height = 0
	elif height >= k:
		time += height // k
		height = height % k
	else:
		height -= min(k, height)
		time += 1
if height == 0:
	s = 0
elif height % k == 0:
	s = height // k
else:
	s = height // k + 1
print(time + s)


(n, h, k) = map(int, input().split())
hh = 0
ans = 0
for x in list(map(int, input().split())):
	if hh + x <= h:
		hh += x
		ans += hh // k
		hh %= k
	else:
		ans += 1
		hh = x % k
		ans += x // k
print(ans + (hh > 0))


import sys
import math
(n, h, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
result = 0
accum = 0
for i in a:
	if accum + i > h:
		secs = math.ceil((accum - (h - i)) / k)
		accum = max(0, accum - k * secs)
		result += secs
	accum += i
result += math.ceil(accum / k)
print(result)


def food_processor(arr, k, h):
	time = 0
	n = len(arr)
	if n == 0:
		return 0
	res = 0
	curr = 0
	for i in range(n):
		if curr + arr[i] <= h:
			curr += arr[i]
		else:
			res += 1
			curr = arr[i]
		res += curr // k
		curr %= k
	res += curr // k
	res += curr % k != 0
	return res
n = list(map(int, input().split()))
k = n[2]
h = n[1]
arr = list(map(int, input().split()))
result = food_processor(arr, k, h)
print(result)


from sys import stdin
(n, h, k) = map(int, stdin.readline().rstrip().split())
l = [int(x) for x in stdin.readline().rstrip().split()]
total = 0
remain = 0
tot_potato = 0
smashed = 0
i = 0
for i in range(len(l)):
	if tot_potato + l[i] <= h:
		tot_potato += l[i]
	else:
		tot_potato = l[i]
		total += 1
	div = tot_potato // k
	total += div
	tot_potato -= div * k
if tot_potato:
	total += 1
print(total)


def get_ints(string):
	return list(map(int, string.split()))

def get_input():
	a = get_ints(input())
	return a

def main():
	(n, h, k) = get_ints(input())
	xs = get_ints(input())
	res = 0
	hh = 0
	for x in xs:
		if hh + x <= h:
			hh += x
		else:
			res += hh // k if hh > k else 1
			hh = hh % k if hh > k else 0
			if hh + x > h:
				res += 1
				hh = x
			else:
				hh += x
	res += hh // k if hh % k == 0 else hh // k + 1
	print(res)
main()


(n, h, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
time = 0
curr_h = 0
for i in range(n):
	if curr_h + a[i] <= h:
		curr_h += a[i]
	else:
		time += 1
		curr_h = a[i]
	time += curr_h // k
	curr_h %= k
if curr_h:
	time += 1
print(time)


(n, h, k) = map(int, input().split())
ans = 0
pot = list(map(int, input().split()))
ost = 0
for i in range(n):
	if pot[i] + ost > h:
		ans += pot[i] // k
		ans += 1
		ost = 0
	else:
		ans += (pot[i] + ost) // k
	ost = (pot[i] + ost) % k
if ost > 0:
	ans += 1
print(ans)


def vafp(l, h, k):
	c = 0
	s = 0
	for i in range(len(l)):
		if l[i] + s <= h:
			p = l[i] + s
			if p >= k:
				c = c + p // k
				s = p % k
			else:
				s = s + l[i]
		else:
			c = c + 1
			c = c + l[i] // k
			s = l[i] % k
	if s > 0:
		c = c + 1
	print(c)
	return
(n, h, k) = map(int, input().split())
l = list(map(int, input().split()))
vafp(l, h, k)


(n, h, k) = list(map(int, input().split()))
a = [int(x) for x in input().split()]
moulin = 0
ans = 0
for x in a:
	if moulin + x <= h:
		moulin += x
	else:
		ready = (x - h + moulin + k - 1) // k
		passed = min(ready, (moulin + k - 1) // k)
		ans += passed
		moulin = max(0, moulin - k * passed)
		moulin += x
ans += (moulin + k - 1) // k
print(ans)


import sys

def main():
	t = sys.stdin.readline().split()
	n = int(t[0])
	h = int(t[1])
	k = int(t[2])
	line = sys.stdin.readline()
	x = list(map(int, line.split()))
	res = 0
	cur = 0
	for i in range(n):
		cur += x[i]
		if i != n - 1:
			if x[i + 1] + cur <= h:
				continue
		v = int(cur / k)
		if v * k != cur:
			cur = cur - v * k
			res += v
			if i != n - 1:
				if x[i + 1] + cur > h:
					res += 1
					cur = 0
			else:
				res += 1
		else:
			cur = 0
			res += v
	print(res)
main()


from sys import stdin, stdout
inp = lambda : (int(o) for o in stdin.readline().split())
sinp = lambda : (o for o in stdin.readline().split())
out = lambda : stdout.write(str(ans))
(n, h, k) = inp()
a = list(inp())
(c, t, i) = (0, 0, 0)
while i < n:
	if c > k:
		t += c // k
		c = c % k
	if c + a[i] <= h:
		c += a[i]
		i += 1
	elif c - k > 0:
		t += c // k
		c = c % k
	else:
		c = 0
		t += 1
if c != 0:
	t += c // k
	if c % k:
		t += 1
ans = t
out()


(n, h, k) = map(int, input().split())
a = list(map(int, input().split()))
t = 0
num = 0
i = 0
while i < n:
	while i < n and t + a[i] <= h:
		t += a[i]
		i += 1
	num += t // k
	t = max(0, t - t // k * k)
	if i < n:
		if t + a[i] <= h:
			continue
		else:
			t = 0
			num += 1
num += t // k + int(t % k != 0)
print(num)


import math
(n, h, k) = map(int, input().split())
seconds = 0
filledSpace = 0
potatoes = list(map(int, input().split()))
for p in potatoes:
	if p + filledSpace <= h:
		filledSpace += p
	else:
		s = math.ceil((p - (h - filledSpace)) / k)
		if s * k > filledSpace:
			filledSpace = 0
		else:
			filledSpace -= s * k
		seconds += s
		filledSpace += p
s = math.ceil(filledSpace / k)
seconds += s
print(str(seconds))


from math import ceil
(n, h, k) = map(int, input().split())
a = list(map(int, input().split()))
cur_h = 0
cur_t = 0
for x in a:
	if cur_h + x <= h:
		cur_h += x
	else:
		num = x + cur_h - h
		t = num // k
		if num % k != 0:
			t += 1
		cur_t += t
		cur_h = max(0, cur_h - k * t) + x
print(cur_t + int(ceil(cur_h / k)))


import sys
(n, h, k) = map(int, sys.stdin.readline().split())
an = list(map(int, sys.stdin.readline().split()))
ans = 0
cur = 0
height = 0
while cur < n:
	if height + an[cur] <= h:
		height += an[cur]
	else:
		ans += 1
		height = an[cur]
	ans += height // k
	height %= k
	cur += 1
	if cur == n and height != 0:
		ans += 1
print(ans)


(n, h, k) = map(int, input().split())
a = list(map(int, input().split()))[::-1]
ans = b = 0
while a != []:
	while len(a) and b + a[-1] <= h:
		b = b + a.pop()
	if b // k == 0:
		(ans, b) = (ans + 1, 0)
	else:
		(ans, b) = (ans + b // k, b % k)
print(ans + (b > 0))


(n, h, k) = map(int, input().split())
z = list(map(int, input().split()))
ans = 0
now_h = 0
for i in range(n):
	if now_h + z[i] > h:
		p = (now_h - h + z[i]) / k
		if int(p) != p:
			p += 1
		p = int(p)
		now_h -= p * k
		now_h = max(now_h, 0)
		now_h += z[i]
		ans += p
	else:
		now_h += z[i]
		continue
p = now_h / k
if int(p) != p:
	p += 1
p = int(p)
ans += p
print(ans)


import math
(count_potato, height_fp, height_crushed) = [int(i) for i in input().split()]
height_each = [int(i) for i in input().split()]
counter_sec = 0
current_height = 0
current_loc = 0
while current_height <= height_fp and current_loc < count_potato:
	if current_height + height_each[current_loc] <= height_fp:
		current_height += height_each[current_loc]
		current_loc += 1
	elif current_height >= height_crushed:
		counter_sec = counter_sec + current_height // height_crushed
		current_height = current_height % height_crushed
	else:
		counter_sec += 1
		current_height = 0
print(counter_sec + math.ceil(current_height / height_crushed))


(n, h, k) = map(int, input().split())
l = list(map(int, input().split()))
space = h
p = 0
t = 0
while True:
	if p < n:
		while space >= l[p]:
			space -= l[p]
			p += 1
			if p == n:
				break
	temp = int((h - space) / k)
	t += temp
	space += temp * k
	if p < n:
		if l[p] > space:
			t += 1
			space = h
	if p == n and h - space < k:
		break
if space != h:
	t += 1
print(int(t))


(n, h, k) = map(int, input().split(' '))
line2 = input().split(' ')
fruitH = []
for x in line2:
	fruitH.append(int(x))
loopVar = 0
height = 0
seconds = 0
once = 0
while loopVar <= n - 1:
	for i in range(loopVar, n):
		if height + fruitH[i] <= h:
			height += fruitH[i]
			loopVar = i + 1
		else:
			loopVar = i
			break
	if height >= k:
		seconds += int(height / k)
		height = height % k
	if loopVar < n:
		if height + fruitH[loopVar] > h:
			height = 0
			seconds += 1
	elif height != 0:
		seconds += 1
print(seconds)


(n, h, j) = map(int, input().split())
pots = [int(x) for x in input().split()]
count = 0
height = 0
pot = 0
while pot < n:
	if height + pots[pot] <= h:
		height += pots[pot]
		count += height // j
		height = height % j
		pot += 1
	elif height <= j:
		height = 0
		count += 1
	else:
		count += height // j
		height = height % j
if height > 0:
	print(count + 1)
else:
	print(count)


def solve(n, h, v, A):
	cnt = 0
	curh = A[0]
	for i in range(1, n):
		if A[i] + curh <= h:
			curh += A[i]
		else:
			quan = int((A[i] + curh - h) / v) + ((A[i] + curh - h) % v > 0)
			cnt += quan
			curh = max(curh - quan * v, 0)
			curh += A[i]
	cnt += int(curh / v) + (curh % v > 0)
	return cnt
(n, h, k) = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
print(solve(n, h, k, A))


(n, h, k) = map(int, input().split())
l = list(map(int, input().split()))
l.append(0)
(s, now, r) = (0, 0, 0)
m = 0
while r < n or now > 0:
	while r < n and now + l[r] <= h:
		now += l[r]
		r += 1
	if r < n:
		m = (l[r] - (h - now) + k - 1) // k
	else:
		m = (now + k - 1) // k
	s += m
	now = max(now - m * k, 0)
print(s)


__author__ = 'artyom'

def main():
	(n, h, k) = read(3)
	a = read(3)
	c = i = d = 0
	while i < n or d > 0:
		while i < n and d + a[i] <= h:
			d += a[i]
			i += 1
		x = a[i] - h + d if i < n else d
		t = (x - 1) // k + 1
		d = max(0, d - t * k)
		c += t
	return c

def read(mode=1, size=None):
	if mode == 0:
		return input().strip()
	if mode == 1:
		return int(input().strip())
	if mode == 2:
		return input().strip().split()
	if mode == 3:
		return list(map(int, input().strip().split()))
	a = []
	for _ in range(size):
		a.append(read(3))
	return a

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, tuple) or isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s, end='\n')
write(main())


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
from bisect import bisect_left

def solve():
	(n, h, k) = map(int, input().split())
	a = list(map(int, input().split()))
	c = 0
	summ = 0
	waste = 0
	for x in a:
		summ += c // k
		c %= k
		if c + x > h:
			(summ, c) = (summ + 1, 0)
		c += x
	print(summ + math.ceil(c / k))
for _ in range(1):
	solve()


(n, h, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
num = 0
time = 0
s = 0
while num < n:
	time += 1
	while num < n and a[num] + s <= h:
		s += a[num]
		num += 1
	s = max(s - k, 0)
	if num < n and s > h - a[num]:
		d = (s - h + a[num] + k - 1) // k
		time += d
		s = max(s - d * k, 0)
print(time + (s + k - 1) // k)


(n, h, k) = map(int, input().split())
a = list(map(int, input().split()))
t = 0
r = a[0]
for i in range(len(a)):
	t = t + r // k
	r = r - r // k * k
	if i != len(a) - 1:
		if r + a[i + 1] <= h:
			r = r + a[i + 1]
		else:
			t += 1
			r = a[i + 1]
	elif r != 0:
		t += 1
print(t)


from sys import stdin
(num, height, smash) = map(int, stdin.readline().split())
potatoes = list(map(int, stdin.readline().split()))
second = 0
currPot = 0
counter = 0
while counter < len(potatoes):
	if currPot + potatoes[counter] <= height:
		currPot = currPot + potatoes[counter]
		second += currPot // smash
		currPot = currPot % smash
		counter += 1
	else:
		second += 1
		currPot -= smash
		if currPot < 0:
			currPot = 0
if currPot > 0:
	second += 1
print(second)


(n, h, k) = [int(x) for x in input().split()]
L = [int(x) for x in input().split()]
L = L[::-1]
p = 0
t = 0
while L:
	if L and h - p >= L[-1]:
		p += L.pop()
	if L:
		req = L[-1] - h + p
		inc = (req - 1) // k + 1
		t += inc
		p -= inc * k
		p = max(p, 0)
if p:
	t += (p - 1) // k + 1
print(t)


(n, h, k) = map(int, input().split())
t = 0
x = 0
for v in map(int, input().split()):
	t += x // k
	x %= k
	if x + v > h:
		(t, x) = (t + 1, 0)
	x += v
print(t + (x + k - 1) // k)


(n, h, k) = map(int, input().split())
a = list(map(int, input().split()))
h1 = 0
ans = 0
i = 0
while i < n:
	while i < n and h1 + a[i] <= h:
		h1 += a[i]
		i += 1
	if h1 < k:
		ans += 1
		h1 = 0
	ans += h1 // k
	h1 %= k
if h1 != 0:
	ans += 1
print(ans)


(n, h, k) = map(int, input().split())
arr = [int(x) for x in input().split()]
ph = 0
second = 0
for i in range(n):
	ph += arr[i]
	if i == n - 1:
		break
	d = h - ph
	x = arr[i + 1] - d
	if x <= 0:
		continue
	plus = 0
	if x % k == 0:
		plus = int(x / k)
	else:
		plus = int(x / k) + 1
	minus = k * plus
	ph -= minus
	if ph < 0:
		ph = 0
	second += plus
plus = 0
if ph % k == 0:
	plus = int(ph / k)
else:
	plus = int(ph / k) + 1
second += plus
print(second)


(n, h, k) = [int(i) for i in input().split(' ')]
arr = [int(i) for i in input().split(' ')]
arr.append(h)
ans = 0
ch = 0
i = 0
while True:
	while h - ch >= arr[i]:
		ch += arr[i]
		i += 1
	(d, m) = divmod(ch, k)
	ans += d
	if h - m >= arr[i]:
		ch = m
	else:
		ans += 1
		ch = 0
	if i == n:
		break
print(ans)


(n, h, k) = map(int, input().split())
a = list(map(int, input().split()))
t = 0
l = 0
i = 0
while True:
	while i < n and h - l >= a[i]:
		l += a[i]
		i += 1
	if l <= k:
		t += 1
		l = 0
	t += l // k
	l %= k
	if i == n and l == 0:
		break
print(t)


import math

def main():
	(n, h, k) = map(int, input().split())
	l = [int(i) for i in input().split()]
	(i, p, ans, done) = (0, 0, 0, 0)
	while i < n:
		while i < n and p + l[i] < h:
			p = p + l[i]
			i += 1
		if i >= n:
			break
		tobe = l[i]
		limit = h - l[i]
		extra = p - limit
		need = math.ceil(extra / k)
		ans += need
		p = max(0, p - need * k)
		p += l[i]
		i += 1
	ans += math.ceil(p / k)
	print(ans)
main()


import math
(n, h, k) = map(int, input().split())
li = list(map(int, input().split()))
s = l = i = 0
while i < n:
	while s < h and i < n:
		s += li[i]
		i += 1
	if s > h:
		i -= 1
		s -= li[i]
	if s > 0 and s < k:
		l += 1
		s = 0
	else:
		l += s // k
		s = s % k
if s > 0:
	l += int(math.ceil(s / k))
print(l)


(n, h, k) = map(int, input().split())
l = list(map(int, input().split()))
ans = 0
total = 0
rem = 0
for i in l:
	total += i
	if total > h:
		total -= rem
		rem = 0
		ans += 1
	ans += total // k
	rem = total % k
	total = rem
if rem == 0:
	print(ans)
else:
	print(ans + 1)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from functools import cmp_to_key
from heapq import *
from math import gcd, factorial, floor, ceil, sqrt
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	y %= p - 1
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
inf = pow(10, 20)
mod = 10 ** 9 + 7

def solve(case):
	(n, h, k) = sep()
	a = lis()
	ans = 0
	rem = 0
	for i in range(n):
		a[i] = a[i] + rem
		if a[i] > h:
			a[i] -= rem
			ans += 1
		ans += a[i] // k
		rem = a[i] % k
	if rem != 0:
		ans += 1
	print(ans)
testcase(1)


(n, h, k) = map(int, input().split())
arr = [int(x) for x in input().split()]
i = 0
curr = 0
t = 0
while i < n or curr > 0:
	while i < n and curr + arr[i] <= h:
		curr += arr[i]
		i += 1
	if curr > k:
		t += curr // k
		curr = curr % k
	else:
		curr = max(0, curr - k)
		t += 1
print(t)


import math
(n, h, k) = (int(i) for i in input().split())
l = list(map(int, input().split()))
ans = 0
i = 0
dh = 0
while i < n:
	if dh + l[i] <= h:
		dh += l[i]
		i += 1
	else:
		ans += math.ceil((l[i] - (h - dh)) / k)
		dh = max(dh - k * math.ceil((l[i] - (h - dh)) / k), 0)
ans += math.ceil(dh / k)
print(ans)


(n, h, k) = map(int, input().split())
ai = list(map(int, input().split()))
num = 0
ans = 0
for i in range(n):
	ans += num // k
	num %= k
	if num + ai[i] > h:
		num = ai[i]
		ans += 1
	else:
		num += ai[i]
if num % k != 0:
	print(ans + num // k + 1)
else:
	print(ans + num // k)


(n, h, k) = map(int, input().split())
n = list(map(int, input().split()))
m = 0
t = 0
c = 0
d = 0
for i in n:
	c += 1
	if m + i <= h:
		m += i
		t += (m - m % k) // k
		m -= m - m % k
	else:
		t += (m - m % k) // k
		m -= m - m % k
		if m + i > h:
			m = 0
			t += 1
		m += i
		t += (m - m % k) // k
		m -= m - m % k
	if c == len(n):
		if m > 0:
			m = 0
			t += 1
print(t)


import math
inf = list(map(int, input().split()))
arr = list(map(int, input().split()))
i = 0
ans = 0
h = inf[1]
k = inf[2]
f = False
total = 0
while True:
	if f:
		break
	while total + arr[i] <= h:
		total += arr[i]
		i += 1
		if i == len(arr):
			f = True
			break
	p = int(total / k)
	if p == 0:
		p = 1
	ans = ans + p
	total = total - p * k
	total = max(0, total)
ans = ans + math.ceil(total / k)
print(ans)


(n, h, k) = map(int, input().split())
heights = [int(x) for x in input().split()]
left_over = 0
seconds = 0
for index in range(0, len(heights)):
	potato_height = heights[index]
	total_height = potato_height + left_over
	if total_height > h:
		total_height = potato_height
		seconds = seconds + 1
	if total_height % k == 0:
		seconds = seconds + int(total_height / k)
		left_over = 0
	else:
		left_over = total_height - k * int(total_height / k)
		seconds = seconds + int(total_height / k)
	if index == len(heights) - 1 and left_over > 0:
		seconds = seconds + 1
print(seconds)


from math import ceil
for _ in range(1):
	(n, h, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	total = 0
	for i in range(n):
		if i < n - 1:
			total += arr[i] // k
			if arr[i] % k + arr[i + 1] <= h:
				arr[i + 1] += arr[i] % k
			else:
				total += 1
		if i == n - 1:
			total += ceil(arr[i] / k)
	print(total)


[n, h, k] = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a.insert(0, 0)
pref = [0]
for i in a:
	pref.append(pref[-1] + i)
free = [h] * (n + 1)
answer = [0] * (n + 1)
for i in range(1, n + 1):
	if a[i] <= free[i - 1]:
		answer[i] = answer[i - 1]
		free[i] = free[i - 1] - a[i]
	else:
		answer[i] = (a[i] - free[i - 1]) // k + 1
		if (a[i] - free[i - 1]) % k == 0:
			answer[i] -= 1
		free[i] = free[i - 1] + answer[i] * k
		if free[i] > h:
			free[i] = h
		free[i] -= a[i]
		answer[i] += answer[i - 1]
answer[n] += (h - free[n]) // k
if (h - free[n]) % k != 0:
	answer[n] += 1
print(answer[n])


(n, h, k) = map(int, input().split())
al = list(map(int, input().split()))
time = 0
c = 0
index = 0
while index < n:
	if index < n and c < k and (c + al[index] > h):
		c = k
	while index < n and c + al[index] <= h:
		c += al[index]
		index += 1
	time += c // k
	c %= k
if c > 0:
	time += 1
print(time)


from math import ceil
(n, h, k) = [int(x) for x in input().split(' ')]
arr = [int(x) for x in input().split(' ')]
time = 0
i = 0
current_sum = 0
while i < n:
	while i < n and current_sum + arr[i] <= h:
		current_sum += arr[i]
		i += 1
	if i < n:
		diff = current_sum - (h - arr[i])
		curr_time = ceil(diff / k)
		time += curr_time
		current_sum = current_sum - curr_time * k if curr_time * k <= current_sum else 0
	else:
		time += ceil(current_sum / k)
print(time)


from math import ceil
(n, h, k) = map(int, input().split())
a = list(map(int, input().split()))
t = h - a[0]
p = 0
for i in range(n - 1):
	if t >= a[i + 1]:
		t -= a[i + 1]
	else:
		d = ceil((a[i + 1] - t) / k)
		t = min(h, t + d * k)
		p += d
		t -= a[i + 1]
p += ceil((h - t) / k)
print(p)


(n, h, k) = map(int, input().split())
(level, secs) = (0, 0)
for potato in input().split():
	if int(potato) + level <= h:
		level += int(potato)
	else:
		sum_to_drop = level - h + int(potato)
		if sum_to_drop % k != 0:
			sum_to_drop += k - sum_to_drop % k
		sum_to_drop = min(sum_to_drop, level)
		secs += sum_to_drop // k if sum_to_drop % k == 0 else sum_to_drop // k + 1
		level += int(potato) - sum_to_drop
secs += level // k
print(secs) if level % k == 0 else print(secs + 1)


from math import *
from collections import deque
from copy import deepcopy
import sys

def inp():
	return sys.stdin.readline().rstrip('\r\n')

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

def strmulti():
	return map(str, inp().split())

def lis():
	return list(map(int, inp().split()))

def lcm(a, b):
	return a * b // gcd(a, b)

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def stringlis():
	return list(map(str, inp().split()))

def out(var):
	sys.stdout.write(str(var))

def printlist(a):
	print(' '.join((str(a[i]) for i in range(len(a)))))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
(n, h, k) = multi()
a = deque(lis())
count = 0
height = 0
i = 0
while True:
	if len(a) == 0:
		while height != 0:
			if height >= k:
				height -= k
				count += 1
			else:
				height = 0
				count += 1
		break
	while len(a) != 0 and h - height >= a[i]:
		if height + a[0] <= h:
			height += a[0]
			a.popleft()
		else:
			break
	if height >= k:
		count += height // k - 1
		height = height % k
	else:
		height = 0
	count += 1
print(count)


def main():
	(n, h, k) = map(int, input().split())
	dat = list(map(int, input().split()))
	ptr = 0
	t = 0
	cur = 0
	while ptr != len(dat):
		if cur + dat[ptr] > h:
			mindecr = cur + dat[ptr] - h
			dt = (mindecr + k - 1) // k
			t += dt
			cur = max(0, cur - dt * k)
			continue
		while ptr != len(dat) and cur + dat[ptr] <= h:
			cur += dat[ptr]
			ptr += 1
		cur = max(0, cur - k)
		t += 1
	t += (cur + k - 1) // k
	print(t)
main()


import sys
(n, h, k) = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
s = a[0]
t = 0
i = 1
while i < n:
	if s >= k:
		t += s // k
		s = s % k
	if s + a[i] <= h:
		s += a[i]
		t += s // k
		s = s % k
		i += 1
	else:
		t += 1
		s = a[i]
		t += s // k
		s = s % k
		i += 1
if s != 0:
	t += s // k
	if s % k:
		t += 1
print(t)


(n, h, k) = [int(i) for i in input().split()]
arr = [int(i) for i in input().split()]
cost = 0
rem = 0
for i in range(n):
	if arr[i] + rem <= h:
		tot = arr[i] + rem
		if tot >= k:
			cost += tot // k
			rem = tot % k
		else:
			rem += arr[i]
	else:
		cost += 1
		cost += arr[i] // k
		rem = arr[i] % k
if rem > 0:
	cost += 1
print(cost)


(n, h, k) = map(int, input().split())
arr = list(map(int, input().split()))
summ = j = sec = 0
i = n
while i:
	while j < n and summ + arr[j] <= h:
		summ += arr[j]
		j += 1
		i -= 1
	if summ < k:
		sec += 1
		summ = 0
	else:
		sec += summ // k
		summ %= k
if summ:
	sec += 1
print(sec)


string = input()
(n, h, k) = string.split()
n = int(n)
h = int(h)
k = int(k)
array = input()
a = array.split()
a = list(map(int, a))
ans = 0
pos = 0
rem = 0
while True:
	if pos < n:
		while rem + a[pos] <= h:
			rem += a[pos]
			pos += 1
			if pos == n:
				break
	ans += rem // k
	rem %= k
	if rem != 0 and (pos == n or rem + a[pos] > h):
		rem = 0
		ans += 1
	if pos == n:
		break
print(ans)


import sys
input = lambda : sys.stdin.readline()
MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : list(map(int, input().split()))
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
(n, h, k) = f()
l = il() + [0]
sm = 0
ans = 0
for i in l:
	ans += sm // k
	sm %= k
	if sm + i > h:
		ans += 1
		sm = 0
	sm += i
print(ans + 1 if sm > 0 else ans)


import math

def main():
	(n, h, k) = [int(x) for x in input().split()]
	potatoes = [int(x) for x in input().split()]
	processor = 0
	remaining = n
	current = 0
	time = 0
	for i in potatoes:
		if processor + i <= h:
			processor += i
		elif processor <= k:
			time += 1
			processor = i
		else:
			time += math.floor(processor / k)
			processor %= k
			if processor + i <= h:
				processor += i
			else:
				time += 1
				processor = i
	if processor:
		time += math.ceil(processor / k)
	print(time)
main()


from collections import deque
(n, h, k) = map(int, input().split())
data = deque(map(int, input().split()))
(ans, total, rem) = (0, 0, 0)
for x in data:
	total = total + x
	if total > h:
		total = total - rem
		rem = 0
		ans = ans + 1
	ans = ans + total // k
	rem = total % k
	total = rem
if rem == 0:
	print(ans)
else:
	print(ans + 1)


def inp(n):
	if n == 1:
		return map(int, stdin.readline().split())
	elif n == 2:
		return map(float, stdin.readline().split())
	else:
		return map(str, stdin.readline().split())

def arr_inp():
	return [int(x) for x in stdin.readline().split()]
from sys import *
from math import *
(n, h, k) = inp(1)
(a, ans) = (arr_inp(), 0)
rem = 0
for i in range(n):
	if i < n - 1:
		ans += a[i] // k
		rem = a[i] % k
		if rem + a[i + 1] > h:
			ans += 1
		else:
			a[i + 1] += rem
print(ans + ceil(a[-1] / k))


from math import ceil
(n, h, k) = map(int, input().strip().split())
potatoes = map(int, input().strip().split())
sec = 0
in_progress = 0
for p in potatoes:
	while p + in_progress > h:
		if in_progress < k:
			sec += 1
			in_progress = 0
		else:
			(elapsed, in_progress) = divmod(in_progress, k)
			sec += elapsed
	in_progress += p
sec += ceil(in_progress / k)
print(sec)


def main():
	(n, h, k) = map(int, input().split())
	tot = l = 0
	for a in map(int, input().split()):
		if l + a > h:
			(t, l) = divmod(l, k)
			tot += t
			if l + a > h:
				tot += 1
				l = a
				continue
		l += a
	print(tot + (l + k - 1) // k)
main()


(n, h, k) = map(int, input().split())
cur = ans = 0
for i in map(int, input().split()):
	cur += i
	if cur > h:
		cur = i
		ans += 1
	ans += cur // k
	cur %= k
if cur != 0:
	ans += 1
print(ans)


(n, h, k) = map(int, input().split())
l_h = list(map(int, input().split()))
t_h = 0
t_s = 0
m = 0
for (index, c_h) in enumerate(l_h):
	if c_h + t_h > h:
		c_t = (-h + t_h + c_h) // k + (1 if (-h + t_h + c_h) % k != 0 else 0)
		t_s += c_t
		t_h = max(t_h - c_t * k, 0)
		t_h += c_h
	else:
		t_h += c_h
t_s += t_h // k + (1 if t_h % k != 0 else 0)
print(t_s)


(n, h, k) = map(int, input().split())
l = [int(s) for s in input().split()]
i = s = c = k1 = 0
while i < n:
	if s + l[i] <= h:
		s += l[i]
		i += 1
		k1 = 0
	elif k1 == 0:
		c += s // k
		s = s % k
		k1 = 1
	else:
		c += 1
		s = 0
c += s // k
s = s % k
if s > 0:
	c += 1
print(c)


[n, h, k] = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
c = 0
i = 0
j = 0
while c + a[i] <= h:
	c += a[i]
	i += 1
	if i == n:
		break
while i < n:
	q = (c + a[i] - h) // k
	if (c + a[i] - h) % k:
		q += 1
	j += q
	c -= q * k
	if c < 0:
		c = 0
	if c + a[i] <= h:
		c += a[i]
		i += 1
j += c // k
if c % k:
	j += 1
print(j)


(n, h, k) = map(int, input().split())
hei = list(map(int, input().split()))
sec = 0
cur = 0
i = 0
while i < len(hei):
	sec += cur // k
	cur = cur % k
	if i < len(hei) and cur + hei[i] > h:
		sec += cur // k + 1
		cur = 0
		cur += hei[i]
		i += 1
	while i < len(hei) and cur + hei[i] <= h:
		cur += hei[i]
		i += 1
sec += cur // k
cur = cur % k
if cur != 0:
	sec += 1
print(sec)


from sys import stdin
(n, h, k) = map(int, stdin.readline().rstrip().split())
l = [int(x) for x in stdin.readline().rstrip().split()]
total = 0
remain = 0
tot_potato = sum(l)
smashed = 0
i = 0
while smashed != tot_potato:
	if i < len(l):
		if l[i] + remain <= h:
			remain += l[i]
			i += 1
			if remain < h:
				continue
	if remain >= k:
		if i < len(l) - 1:
			if remain + l[i] <= h:
				remain -= k
				smashed += k
				total += 1
			else:
				rest = remain % k
				div = remain // k
				total += div
				smashed += k * div
				remain = rest
		else:
			rest = remain % k
			div = remain // k
			total += div
			smashed += k * div
			remain = rest
	else:
		smashed += remain
		remain = 0
		total += 1
print(total)


(n, h, k) = map(int, input().split())
(a, ai, c, t) = (list(map(int, input().split())), 0, 0, 0)
while c > 0 or ai < n:
	while ai < n and c + a[ai] <= h:
		c += a[ai]
		ai += 1
	if c < k:
		t += 1
		c = 0
	else:
		t += c // k
		c %= k
print(t)


(n, h, k) = map(int, input().split())
a = [int(i) for i in input().split()]
l = 0
t = 0
for c in a:
	if l + c > h:
		tt = (l + c - h) // k
		if (l + c - h) % k != 0:
			tt += 1
		l -= tt * k
		if l < 0:
			l = 0
		t += tt
	l += c
tt = l // k
if l % k != 0:
	tt += 1
t += tt
print(t)


(n, h, k) = map(int, input().split())
arr = [int(z) for z in input().split()]
import math
res = 0
for i in range(n - 1):
	a = arr[i]
	res += a // k
	if a % k <= h - arr[i + 1]:
		arr[i + 1] = arr[i + 1] + a % k
		continue
	res += 1
res += arr[-1] // k
if arr[-1] % k:
	res += 1
print(res)


import math
(n, h, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
c = 0
for i in range(n):
	if c + a[i] <= h:
		c += a[i]
	else:
		temp = math.ceil((c - h + a[i]) / k)
		ans += temp
		if c - temp * k <= 0:
			c = a[i]
		else:
			c = c - k * temp + a[i]
if c == 0:
	print(ans)
else:
	print(ans + math.ceil(c / k))


(n, h, k) = map(int, input().split())
A = list(map(int, input().split()))
(cnt, cur, ans) = (0, 0, 0)
while True:
	while cnt < n and cur <= h:
		cur += A[cnt]
		cnt += 1
	if cur > h:
		cur -= A[cnt - 1]
		cnt -= 1
	cur -= min(k, cur)
	ans += 1
	if cnt == n:
		ans += cur // k
		if cur % k != 0:
			ans += 1
		break
	if cnt < n and cur + A[cnt] >= h:
		ans += (cur + A[cnt] - h) // k
		cur -= (cur + A[cnt] - h) // k * k
	if cur <= 0 and cnt == n:
		break
print(ans)


(n, h, k) = map(int, input().split())
potato_list = map(int, input().split())
ans = 0
now = 0
for potato in potato_list:
	if now + potato > h:
		ans += 1
		now = 0
	now += potato
	ans += now // k
	now = now % k
if now != 0:
	ans += 1
print(ans)


from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect

def array2d(d1, d2, init=None):
	return [[init for _ in range(d1)] for _ in range(d2)]
(n, h, k) = map(int, input().split(' '))
al = map(int, input().split(' '))
in_proc = 0
pointer = 0
time = 0
for a in al:
	if a > h - in_proc:
		time += in_proc // k
		in_proc %= k
		if a > h - in_proc:
			time += 1
			in_proc = 0
	in_proc += a
time += in_proc // k
in_proc %= k
time += in_proc > 0
print(time)


import sys

def minp():
	return sys.stdin.readline().strip()
(n, h, k) = map(int, minp().split())
s = 0
r = 0
for i in map(int, minp().split()):
	if s + i > h:
		cnt = (s + i - h + k - 1) // k
		r += cnt
		s -= cnt * k
		s = max(s, 0)
	s += i
if s > 0:
	r += (s + k - 1) // k
print(r)


(n, m, k) = map(int, input().split())
a = [int(x) for x in input().split()]
remain = 0
ans = 0
for i in range(n):
	t = remain + a[i] - m
	if t <= 0:
		remain += a[i]
	else:
		if t % k == 0:
			times = t // k
		else:
			times = t // k + 1
		ans += times
		remain -= times * k
		remain = max(remain, 0)
		remain += a[i]
if remain % k == 0:
	ans += remain // k
else:
	ans += remain // k + 1
print(ans)


(n, h, k) = map(int, input().split())
(t, x) = (0, 0)
w = list(map(int, input().split()))
for z in w:
	t += x // k
	x %= k
	if x + z > h:
		(t, x) = (t + 1, 0)
	x += z
t += (x + k - 1) // k
print(t)


read = lambda : list(map(int, input().split()))
(n, h, k) = read()
a = list(read())
ans = rem = 0
for i in range(n):
	if rem != 0 and rem + a[i] > h:
		ans += 1
	else:
		a[i] += rem
	ans += a[i] // k
	rem = a[i] % k
if rem != 0:
	ans += 1
print(ans)


from math import ceil
(n, h, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
c = 0
for i in range(n):
	if c + a[i] <= h:
		c += a[i]
	else:
		d = a[i] - (h - c)
		s = ceil(d / k)
		ans += s
		c = c - min(c, s * k) + a[i]
print(ans + ceil(c / k))


import math
(n, h, k) = map(int, input().split())
arr = list(map(int, input().split()))
(i, ans, temp, j) = (0, 0, 0, 0)
while i <= n:
	if i < n and temp + arr[i] <= h and (temp + arr[i] >= k):
		temp += arr[i]
		ans += temp // k
		temp = temp % k
		i += 1
	elif i < n and temp + arr[i] > h:
		ans += math.ceil(temp / k)
		temp = 0
	elif i == n:
		ans += math.ceil(temp / k)
		temp = 0
		i += 1
	else:
		temp += arr[i]
		i += 1
print(ans)


(n, h, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
height = 0
count = 0
i = 0
while i < n:
	if height >= k:
		count += height // k
		height = height % k
	if height + a[i] <= h:
		height += a[i]
		i += 1
	else:
		height = max(0, height - k)
		count += 1
if height > 0:
	count += (height + k - 1) // k
print(count)


d = input().split()
d = [int(x) for x in d]
(n, h, k) = (d[0], d[1], d[2])
d = input().split()
d = [int(x) for x in d]
S = 0
R = 0
for i in d:
	if R + i <= h:
		S += i // k
		R += i % k
	else:
		while R + i > h:
			if R % k == 0:
				S += R // k
				R = 0
			elif R < k:
				S += 1
				R = 0
			else:
				S += R // k
				R = R % k
		S += i // k
		R += i % k
if R % k == 0:
	S += R // k
else:
	S += R // k
	S += 1
print(S)


(n, h, k) = map(int, input().split())
lis = list(map(int, input().split()))
prev = 0
ans = 0
for i in range(n):
	if prev + lis[i] > h:
		prev = 0
		ans += 1
	ans += (prev + lis[i]) // k
	prev = (prev + lis[i]) % k
if prev != 0:
	ans += 1
print(ans)


(n, h, k) = map(int, input().split())
a = list(map(int, input().split()))
tot = sum(a)
t = 0
filled = 0
i = 0
cannot_put = None
while i < n:
	prev_cannot_put = cannot_put
	cannot_put = False
	if filled + a[i] <= h:
		filled += a[i]
		i += 1
	else:
		cannot_put = True
	if cannot_put:
		if filled <= k:
			t += 1
			filled = 0
		else:
			t += filled // k
			filled = filled % k
	elif filled == h:
		t += 1
		filled -= k
		if filled < 0:
			filled = 0
if filled > 0:
	if filled <= k:
		t += 1
		filled = 0
	else:
		t += filled // k
		if filled % k > 0:
			t += 1
		filled = 0
print(t)


from sys import stdin

def main():
	(nbPatates, hauteurCompresseur, hauteurCompresse) = map(int, input().split())
	patates = list(map(int, stdin.readline().split()))
	t = 0
	hauteurMise = 0
	for patate in patates:
		if hauteurMise + patate <= hauteurCompresseur:
			hauteurMise += patate
		else:
			ecart = hauteurMise + patate - hauteurCompresseur
			nbEcrasement = ecart // hauteurCompresse
			if ecart % hauteurCompresse != 0:
				nbEcrasement += 1
			t += nbEcrasement
			hauteurMise -= nbEcrasement * hauteurCompresse
			hauteurMise = max(0, hauteurMise)
			hauteurMise += patate
	if hauteurMise % hauteurCompresse != 0:
		t += 1
	t += hauteurMise // hauteurCompresse
	print(t)
main()


(n, h, k) = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]
curr = 0
t = 0
for i in range(n):
	if curr + H[i] <= h:
		curr += H[i]
		t += curr // k
		curr %= k
	else:
		t += 1
		curr = H[i] % k
		t += H[i] // k
if curr != 0:
	t += 1
print(t)


from math import *

def main():
	(n, h, k) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 0
	inside = 0
	i = 0
	while True:
		nxt = a[i]
		while inside + nxt <= h:
			inside += nxt
			i += 1
			if i == n:
				nxt = h
				break
			nxt = a[i]
		smash = nxt - (h - inside)
		seconds = int(ceil(smash / k))
		ans += seconds
		inside -= k * seconds
		if inside < 0:
			inside = 0
		if i > n - 1 and inside == 0:
			break
	print(ans)
main()


(n, h, k) = map(int, input().split())
a = list(map(int, input().split()))
ret = 0
cur = 0
for (i, v) in enumerate(a):
	if cur + v > h:
		(left, right) = (-1, 10 ** 9 + 1)
		while left + 1 < right:
			mid = left + right >> 1
			if cur - k * mid + v <= h:
				right = mid
			else:
				left = mid
		ret += right
		cur -= k * right
	cur = max(cur, 0)
	cur += v
print(ret + (cur + k - 1) // k)


(n, h, k) = (int(x) for x in input().split())
a = [int(x) for x in input().split()]
(t, p, i) = (0, 0, 0)
while i < len(a) or p > 0:
	while i < len(a) and p + a[i] <= h:
		p += a[i]
		i += 1
	if p >= k:
		q = p // k
		p = p - q * k
		t += q
	else:
		p = 0
		t += 1
print(t)


(n, h, k) = map(int, input().split())
p = list(map(int, input().split()))
s = 0
cur = 0
shift = 0
for i in range(n):
	if cur + p[i] <= h:
		cur += p[i]
	else:
		s += cur // k
		cur = cur % k
		if cur + p[i] > h:
			s += 1
			cur = 0
		cur += p[i]
s += cur // k + (1 if cur % k != 0 else 0)
print(s)


import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect

def array2d(d1, d2, init=None):
	return [[init for _ in range(d1)] for _ in range(d2)]
(n, h, k) = list(map(int, input().split(' ')))
al = list(map(int, input().split(' ')))
in_proc = 0
pointer = 0
time = 0
for a in al:
	if a > h - in_proc:
		time += in_proc // k
		in_proc %= k
		if a > h - in_proc:
			time += 1
			in_proc = 0
	in_proc += a
time += in_proc // k
in_proc %= k
time += in_proc > 0
print(time)


def goodceil(a, b):
	return (a + b - 1) // b
(n, maxh, k) = map(int, input().split())
p = list(map(int, input().split()))
curh = 0
curtime = 0
time = 0
i = 0
while i < len(p):
	while i < len(p) and curh + p[i] <= maxh:
		curh += p[i]
		i += 1
	if i <= len(p) - 1:
		curtime = goodceil(curh + p[i] - maxh, k)
	else:
		curtime = goodceil(curh, k)
	curh = max(curh - curtime * k, 0)
	time += curtime
print(time)


(N, H, K) = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
result = 0
fill = 0
p = 0
while p < len(A) or fill != 0:
	while p < len(A) and fill + A[p] <= H:
		fill += A[p]
		p += 1
	if p < len(A):
		need = A[p] - (H - fill)
	else:
		need = fill
	time = (need + K - 1) // K
	fill = max(0, fill - time * K)
	result += time
print(result)


(n, h, k) = map(int, input().split())
pots = map(int, input().split())
comb = [0]
for pot in pots:
	if comb[-1] % k + pot <= h:
		comb[-1] += pot
	else:
		comb.append(pot)
sec = lambda x: x // k + int(x % k > 0)
ans = sum(map(sec, comb))
print(ans)


from math import ceil
(n, h, k) = map(int, input().split())
a = list(map(int, input().split()))
r = 0
c = 0
i = 0
while i < n:
	while i < n and c + a[i] <= h:
		c += a[i]
		i += 1
	if i < n:
		m = (c + a[i] - h) // k
		m = max(1, m)
		r += m
		c -= m * k
		c = max(0, c)
r += ceil(c / k)
print(r)