Chef has X 5 rupee coins and Y 10 rupee coins. Chef goes to a shop to buy chocolates for Chefina where each chocolate costs Z rupees. Find the maximum number of chocolates that Chef can buy for Chefina.

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

- The first line contains a single integer T — the number of test cases. Then the test cases follow.
- The first and only line of each test case contains three integers X, Y and Z — the number of 5 rupee coins, the number of 10 rupee coins and the cost of each chocolate.

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

For each test case, output the maximum number of chocolates that Chef can buy for Chefina.

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

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

----- Sample Input 1 ------ 
4
10 10 10
3 1 8
8 1 3
4 4 1000
----- Sample Output 1 ------ 
15
3
16
0

----- explanation 1 ------ 
Test case $1$: Chef has $10 \cdot 5 + 10 \cdot 10 = 150$ rupees in total. Since each chocolate costs $10$ rupees, Chef can spend all $150$ rupees and buy $15$ chocolates for Chefina.

Test case $2$: Chef has $3 \cdot 5 + 1 \cdot 10 = 25$ rupees in total. Since each chocolate costs $8$ rupees, Chef can buy a maximum of $3$ chocolates for Chefina, leaving him with $1$ rupee.

Test case $3$: Chef has $8 \cdot 5 + 1 \cdot 10 = 50$ rupees in total. Since each chocolate costs $3$ rupees, Chef can buy a maximum of $16$ chocolates for Chefina, leaving him with $2$ rupee.

Test case $4$: Chef has $4 \cdot 5 + 4 \cdot 10 = 60$ rupees in total. Since each chocolate costs $1000$ rupees, Chef can buy no chocolate for Chefina, leaving him with $60$ rupees.

Source: codechef | Difficulty: EASY
Tags: Mathematics


Solutions:
T = int(input())
for i in range(T):
	(X, Y, Z) = map(int, input().split())
	a = X * 5 + Y * 10
	print(a // Z)


t = int(input())
for i in range(t):
	(x, y, z) = map(int, input().split())
	print((x * 5 + y * 10) // z)


for _ in range(int(input())):
	(x, y, z) = map(int, input().split())
	d = x * 5 + y * 10
	print(int(d // z))


for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	d = a * 5
	e = b * 10
	print((d + e) // c)


a = int(input())
for i in range(a):
	(x, y, z) = map(int, input().split())
	a1 = x * 5 + y * 10
	print(a1 // z)


n = int(input())
for i in range(n):
	(a, b, z) = map(int, input().split())
	x = a * 5 + b * 10
	print(int(x / z))


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	d = a * 5 + b * 10
	e = int(d / c)
	print(e)


t = int(input())
for i in range(t):
	(X, Y, Z) = map(int, input().split())
	print((5 * X + 10 * Y) // Z)


t = int(input())
for i in range(t):
	(x, y, z) = map(int, input().split())
	total = x * 5 + y * 10
	no_chocolates = total // z
	print(abs(no_chocolates))


n = int(input())
for n in range(0, n):
	(x, y, z) = map(int, input().split())
	print((x * 5 + y * 10) // z)


T = int(input())
for i in range(T):
	(x, y, z) = map(int, input().split())
	total = x * 5 + y * 10
	buy = total // z
	print(buy)


n = int(input())
for i in range(n):
	m = input().split()
	print((int(m[0]) * 5 + int(m[1]) * 10) // int(m[2]))


n = int(input())
for i in range(0, n):
	(a, b, c) = map(int, input().split(' '))
	t = a * 5 + b * 10
	if t < c:
		print(0)
	else:
		print(int(t / c))


n = int(input())
for i in range(n):
	(a, b, c) = map(int, input().split())
	print((a * 5 + b * 10) // c)


t = int(input())
for i in range(0, t):
	(a, b, c) = map(int, input().split())
	res = a * 5 + b * 10
	print(res // c)


for _ in range(int(input())):
	(x, y, z) = map(int, input().split())
	X = 5 * x
	Y = 10 * y
	c = (X + Y) // z
	print(c)


t = int(input())
while t:
	(x, y, z) = map(int, input().split())
	a = 5 * x + 10 * y
	print(int(a / z) if a > z else 0)
	t -= 1


i = int(input(''))
j = 0
while j < i:
	(x, y, z) = map(int, input('').split())
	t = x * 5 + y * 10
	op = t // z
	j += 1
	print(op)


t = int(input())
for i in range(t):
	(n, m, p) = map(int, input().split())
	print((n * 5 + m * 10) // p)


T = int(input())
for i in range(T):
	(X, Y, Z) = map(int, input().split())
	total_rupees = X * 5 + Y * 10
	chocolate_rupee = total_rupees // Z
	print(chocolate_rupee)


T = int(input())
for i in range(T):
	(x, y, z) = map(int, input().split())
	r = x * 5 + y * 10
	(s, g) = divmod(r, z)
	print(s)


T = int(input())
for i in range(0, T):
	(X, Y, Z) = input().split()
	x = int(X)
	y = int(Y)
	z = int(Z)
	rupees = x * 5 + y * 10
	cost = rupees // z
	print(cost)


z = int(input())
while z != 0:
	(a, b, c) = map(int, input().split())
	print(int((5 * a + 10 * b) / c))
	z -= 1


t = int(input())
for i in range(t):
	(x, y, z) = map(int, input().split())
	a = x * 5
	b = y * 10
	c = a + b
	print(c // z)


T = int(input())
for i in range(T):
	(X, Y, Z) = map(int, input().split())
	total_amount = X * 5 + Y * 10
	max_chocolates = total_amount // Z
	print(max_chocolates)


for i in range(int(input())):
	(x, y, z) = map(int, input().split())
	t = x * 5 + y * 10
	if t >= z:
		print(t // z)
	else:
		print('0')


for i in range(int(input())):
	(X, Y, Z) = map(int, input().split())
	amount_in_fives = X * 5
	amount_in_tens = Y * 10
	max_chocolates = (amount_in_fives + amount_in_tens) / Z
	print(int(max_chocolates))


t = int(input())
for i in range(t):
	(x, y, z) = input().split()
	(x, y, z) = (int(x), int(y), int(z))
	total_coins = x * 5 + y * 10
	max_choco = total_coins // z
	print(max_choco)


n = int(input())
for i in range(n):
	(x, y, z) = map(int, input().split())
	five = x * 5
	ten = y * 10
	total = five + ten
	choco = total / z
	print(int(choco))


n = int(input())
for i in range(n):
	(five, ten, each_chocolate) = input().split(' ')
	five_rupees = int(five) * 5
	ten_rupees = int(ten) * 10
	total_money = five_rupees + ten_rupees
	total_chocolates = total_money // int(each_chocolate)
	print(total_chocolates)


T = int(input())
for _ in range(T):
	(X, Y, Z) = map(int, input().split())
	print((5 * X + 10 * Y) // Z)


n = int(input())
for i in range(n):
	a = list(map(int, input().split(' ')))
	t = a[0] * 5 + a[1] * 10
	print(t // a[2])


n = int(input())
for i in range(n):
	lst = list(map(int, input().split()))[:3]
	print(int((lst[0] * 5 + lst[1] * 10) / lst[2]))


a = int(input())
for i in range(a):
	(x, y, z) = map(int, input().split())
	c = x * 5 + y * 10
	d = c // z
	print(d)