*Chef is moving to a new house!*

*Unfortunately, this means he now has to pack up his things so that they can be moved too. Currently, Chef is packing up his (rather impressive) book collection into cardboard boxes.*

Chef has X shelves of books, each of which contains exactly Y books. Each cardboard box can hold at most Z books. In order to not mess up the organization of the books, Chef will also ensure that books from different shelves will not be placed in the same box.

Under these conditions, what is the minimum number of boxes needed to pack all the books?

------ Input Format ------ 

- The first line of input will contain a single integer T, denoting the number of test cases.
- Each test case consists of one line of input, containing three space-separated integers X, Y, and Z: the values described in the statement.

------ Output Format ------ 

For each test case, output on a new line one integer: the minimum number of boxes needed to pack all the books.

------ Constraints ------ 

$1 ≤ T ≤ 1000$
$1 ≤ X, Y, Z ≤ 1000$

----- Sample Input 1 ------ 
4
5 9 9
5 9 7
2 3 2
22 34 12

----- Sample Output 1 ------ 
5
10
4
66

----- explanation 1 ------ 
Test case $1$: Each box can hold $9$ books, and each shelf has $9$ books. So, Chef needs only five boxes: one for each shelf.

Test case $2$: Each box can hold $7$ books, and each shelf has $9$ books. So, Chef needs two boxes to hold all the books of one shelf (for example, one holding $4$ books and another one holding $5$). There are five shelves, so the total number of boxes needed is $5\times 2 = 10$.

Test case $3$: Each box can hold $2$ books, and each shelf has $3$ books. So, Chef needs two boxes to hold all the books of one shelf (for example, one holding $2$ books and another one holding $1$). There are two shelves, so the total number of boxes needed is $2\times 2 = 4$.

Test case $4$: Each shelf needs $3$ boxes to pack all its books. There are $22$ shelves, so the answer is $22\times 3 = 66$.

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
n = int(input())
for i in range(n):
	(x, y, z) = map(int, input().split())
	c = 0
	if y < z:
		c = 1
	elif y % z == 0 and y >= z:
		c = y // z
	elif y % z != 0 and y >= z:
		c = y // z + 1
	print(c * x)


for _ in range(int(input())):
	(X, Y, Z) = map(int, input().split())
	if Y % Z == 0:
		print(Y // Z * X)
	else:
		print((Y // Z + 1) * X)


def books(x, y, z):
	boxes = lambda y, z: y // z + 1 if y % z else y // z
	return boxes(y, z) * x
t = int(input())
for _ in range(t):
	(x, y, z) = map(int, input().split())
	print(books(x, y, z))


from math import ceil
for i in range(int(input())):
	(x, y, z) = map(int, input().split())
	print(x * ceil(y / z))


import math
t = int(input())
cnt = 0
for i in range(0, t):
	(x, y, z) = list(map(int, input().split()))
	if y > z:
		print(math.ceil(y / z) * x)
	else:
		print(x)


import math
for _ in range(int(input())):
	(x, y, z) = map(int, input().split())
	rest = math.ceil(y / z)
	if y <= z:
		print(x)
	elif rest > 0:
		print(x * rest)


import math
for j in range(int(input())):
	(x, y, z) = map(int, input().split())
	print(x * math.ceil(y / z))


t = int(input())
while t > 0:
	(x, y, z) = input().split()
	(x, y, z) = [int(x), int(y), int(z)]
	count = a = 0
	if z >= y:
		print(x)
	elif z > y // 2 and z < y:
		print(2 * x)
	else:
		count = y // z
		a = y - count * z
		if a != 0:
			print(x * (count + 1))
		else:
			print(x * count)
	t = t - 1


t = int(input())
while t > 0:
	(x, y, z) = input().split()
	(x, y, z) = [int(x), int(y), int(z)]
	count = a = 0
	count = y // z
	a = y - count * z
	if a != 0:
		print(x * (count + 1))
	else:
		print(x * count)
	t = t - 1


t = int(input())
while t > 0:
	(x, y, z) = input().split()
	(x, y, z) = [int(x), int(y), int(z)]
	print(-(-y // z) * x)
	t = t - 1


def Packing(x, y, z):
	if y % z == 0:
		print(y // z * x)
	else:
		print((y // z + 1) * x)
for _ in range(int(input())):
	(x, y, z) = map(int, input().split())
	Packing(x, y, z)


from math import ceil
for _ in range(int(input())):
	(shelves, books_per_shelf, books_per_box) = map(int, input().split())
	print(ceil(books_per_shelf / books_per_box) * shelves)


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	if b % c == 0:
		print(int(a * (b / c)))
	else:
		print(a * (int(b / c) + 1))


for i in range(int(input())):
	(x, y, z) = map(int, input().split())
	if y % z == 0:
		print(y // z * x)
	else:
		print((y // z + 1) * x)


t = int(input())
for i in range(t):
	(x, y, z) = map(int, input().split())
	count = 0
	while y > 0:
		count += 1
		y -= z
	print(count * x)


n = int(input())
for i in range(n):
	(a, b, c) = map(int, input().split())
	if b <= c:
		print(a)
	elif b % c == 0:
		e = b // c
		print(a * e)
	else:
		e = b // c + 1
		print(a * e)


T = int(input())
for i in range(T):
	(X, Y, Z) = map(int, input().split())
	C = Y // Z
	if Y % Z == 0:
		print(X * C)
	else:
		print(X * (C + 1))


t = int(input())
for i in range(t):
	s = list(map(int, input().split()))
	if s[2] < s[1]:
		a = s[1] // s[2]
		if float(a) < s[1] / s[2]:
			a += 1
		n = a * s[0]
	else:
		n = s[0]
	print(n)


t = int(input())
for _ in range(t):
	(x, y, z) = map(int, input().split())
	m = y // z
	if y % z == 0:
		print(m * x)
	else:
		print((m + 1) * x)


import math
t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	m = math.ceil(b / c)
	n = m * a
	print(n)


T = int(input())
for n in range(T):
	num = input()
	asdf = num.split()
	(shelves, bps, boxcap) = list(map(int, asdf))
	boxes = bps // boxcap * shelves
	if bps % boxcap > 0:
		boxes += shelves
	print(boxes)


t = int(input())
for i in range(t):
	(X, Y, Z) = map(int, input().split())
	if Y % Z == 0:
		print(Y // Z * X)
	else:
		print((Y // Z + 1) * X)


import math
for i in range(int(input())):
	(x, y, z) = map(int, input().split())
	if y == z:
		print(x)
	else:
		print(x * math.ceil(y / z))


import math
n = int(input())
for i in range(n):
	(a, b, c) = list(map(int, input().split()))
	print(a * math.ceil(b / c))


test_cases = int(input())
for _ in range(test_cases):
	(x, y, z) = map(int, input().split(' '))
	if y % z != 0:
		print(y // z * x + x)
	else:
		print(y // z * x)


t = int(input())
for i in range(t):
	(x, y, z) = map(int, input().split())
	if y % z == 0:
		print(int(y / z) * x)
	else:
		a = int(y / z) + 1
		k = a * x
		print(k)


t = int(input())
for i in range(t):
	(n, k, x) = map(int, input().split())
	if k % x == 0:
		print(k // x * n)
	else:
		s = (k // x + 1) * n
		print(s)


t = int(input())
for i in range(t):
	(x, y, z) = map(int, input().split())
	tot = y
	count = 0
	flag = True
	while flag:
		tot -= z
		count += 1
		if tot <= 0:
			flag = False
	print(x * count)


import math
t = int(input())
for _ in range(t):
	(x, y, z) = map(int, input().split())
	print(math.ceil(int(y) / int(z)) * int(x))


import math
for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	d = math.ceil(b / c)
	print(d * a)


t = int(input())
for _ in range(t):
	(x, y, z) = list(map(int, input().split()))
	total = 0
	rem = y % z
	if rem == 0:
		print(y // z * x)
	else:
		print((y // z + 1) * x)


for _ in range(int(input())):
	(x, y, z) = map(int, input().split())
	c = 0
	if y > z:
		if y % z == 0:
			print(y // z * x)
		else:
			print((y // z + 1) * x)
	else:
		print(1 * x)


import math
for i in range(int(input())):
	(n, x, y) = map(int, input().split())
	a = math.ceil(x / y)
	print(n * a)


for a in range(int(input())):
	(x, y, z) = map(int, input().split())
	a = y // z
	if y % z != 0:
		a = a + 1
	print(a * x)


import math
a = int(input())
for i in range(a):
	b = [int(x) for x in input().split()]
	c = math.ceil(b[1] / b[2])
	print(c * b[0])


import math
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	print(math.ceil(b / c) * a)


t = int(input())
while t > 0:
	t = t - 1
	(a, b, c) = map(int, input().split())
	if b >= c:
		if b % c == 0:
			d = b // c
		else:
			d = b // c + 1
	else:
		d = 1
	print(a * d)


T = int(input())
if T >= 1 and T <= 1000:
	for i in range(0, T):
		(X, Y, Z) = map(int, input().split())
		R = Y // Z
		if R * Z < Y:
			print(X * (R + 1))
		else:
			print(X * R)


import math
T = int(input())
for _ in range(T):
	(X, Y, Z) = map(int, input().split())
	boxes_per_shelf = math.ceil(Y / Z)
	tot_boxes = X * boxes_per_shelf
	print(tot_boxes)


import math
for i in range(int(input())):
	(x, y, z) = map(int, input().split())
	if y > z:
		k = math.ceil(y / z)
		print(k * x)
	elif z >= y:
		print(x)


import math
for t in range(0, int(input()), 1):
	(x, y, z) = map(int, input().split())
	k = math.floor(y / z)
	if k == y / z:
		print(k * x)
	else:
		print((k + 1) * x)


import math
t = int(input())
for i in range(t):
	(X, Y, Z) = map(int, input().split())
	div = math.ceil(Y / Z)
	print(X * div)


for _ in range(int(input())):
	(shelvs, books, capacity) = map(int, input().split())
	if books <= capacity:
		print(shelvs)
	else:
		need = books // capacity
		if books % capacity == 0:
			print(shelvs * need)
		else:
			print(shelvs * (need + 1))


for _ in range(int(input())):
	(x, y, z) = list(map(int, input().split()))
	if y <= z:
		print(x)
	else:
		k = y // z
		if y % z == 0:
			print(k * x)
		else:
			print((k + 1) * x)


import math as m
for _ in range(int(input())):
	(x, y, z) = map(int, input().split())
	print(x * m.ceil(y / z))


import math
T = int(input())
for x in range(T):
	(a, b, c) = map(int, input().split())
	m = math.ceil(b / c)
	print(a * m)