Chef has infinite coins in denominations of rupees 5 and rupees 10.

Find the minimum number of coins Chef needs, to pay exactly X rupees. If it is impossible to pay X rupees in denominations of rupees 5 and 10 only, print -1.

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

- First line will contain T, number of test cases. Then the test cases follow.
- Each test case contains of a single integer X.

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

For each test case, print a single integer - the minimum number of coins Chef needs, to pay exactly X rupees. If it is impossible to pay X rupees in denominations of rupees 5 and 10 only, print -1.

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

$1 ≤ T ≤ 1000$
$1 ≤ X ≤ 1000$

------ subtasks ------ 

Subtask 1 (100 points): Original constraints.

----- Sample Input 1 ------ 
3
50
15
8

----- Sample Output 1 ------ 
5
2
-1

----- explanation 1 ------ 
Test Case $1$: Chef would require at least $5$ coins to pay $50$ rupees. All these coins would be of rupees $10$.

Test Case $2$: Chef would require at least $2$ coins to pay $15$ rupees. Out of these, $1$ coin would be of rupees $10$ and $1$ coin would be of rupees $5$.

Test Case $3$: Chef cannot pay exactly $8$ rupees in denominations of rupees $5$ and $10$ only.

Difficulty: EASY

Solutions:
for i in range(int(input())):
	x = int(input())
	if x % 5 == 0:
		if x % 10 == 0:
			print(x // 10)
		else:
			print(int(x / 10) + 1)
	else:
		print(-1)


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 10 == 0:
		print(n // 10)
	elif n % 10 != 0 and n % 5 == 0:
		print(n // 10 + 1)
	else:
		print('-1')


t = int(input())
for i in range(t):
	x = int(input())
	if x % 5 != 0 and x % 10 != 0:
		print('-1')
	elif x % 10 == 0:
		a = x // 10
		if x % 5 == 0:
			b = x // 5
		print(b - a)
	elif x % 5 == 0:
		a = x // 10
		b = x // 5
		print(b - a)
	else:
		break


import math
for t in range(int(input())):
	x = int(input())
	if x % 5 == 0:
		print(math.ceil(x / 10))
	else:
		print(-1)


a = [10, 5]
for i in range(int(input())):
	n = int(input())
	b = 0
	for j in range(2):
		if a[j] <= n:
			b = b + n // a[j]
			n = n % a[j]
	if n == 0:
		print(b)
	else:
		print(-1)


T = int(input())
for i in range(0, T):
	x = int(input())
	if x % 5 != 0:
		print('-1')
	else:
		t1 = x // 10
		t2 = x % 10 // 5
		print(t1 + t2)


t = int(input())
for i in range(t):
	X = int(input())
	if X % 10 == 0:
		print(X // 10)
	elif X % 5 == 0:
		print(X // 10 + 1)
	else:
		print(-1)


T = int(input())
for i in range(T):
	a = int(input())
	rupees10 = a / 10
	rest10 = a % 10
	ruppes5 = rest10 / 5
	if rest10 % 5 != 0:
		print('-1')
	else:
		print(int(rupees10 + ruppes5))


t = int(input())
while t > 0:
	x = int(input())
	count = a = b = c = 0
	if x % 5 == 0 or x % 10 == 0:
		a = x // 10
		count = count + a
		b = x - a * 10
		c = b // 5
		count = count + c
		print(count)
	else:
		print(-1)
	t = t - 1


for _ in range(int(input())):
	x = int(input())
	(a, b) = (5, 10)
	if x % b == 0:
		print(x // 10)
	elif x % b != 0 and x % a == 0:
		print(x // 10 + 1)
	else:
		print(-1)


import math
t = int(input())
for i in range(t):
	a = int(input())
	if a % 5 != 0:
		print('-1')
	elif a % 10 == 0:
		print(int(a / 10))
	else:
		c = a / 10
		print(math.ceil(c))


t = int(input())
for _ in range(t):
	x = int(input())
	coins = lambda x: -1 if x % 5 else x // 10 + 1 if x % 10 else x // 10
	print(coins(x))


def min_coins(X):
	if X % 5 != 0:
		return -1
	min_num_coins = float('inf')
	max_num_10_coins = X // 10
	for num_10_coins in range(max_num_10_coins + 1):
		remaining_amount = X - 10 * num_10_coins
		num_5_coins = remaining_amount // 5
		total_num_coins = num_5_coins + num_10_coins
		if total_num_coins < min_num_coins:
			min_num_coins = total_num_coins
	return min_num_coins
T = int(input())
for _ in range(T):
	X = int(input())
	print(min_coins(X))


for i in range(int(input())):
	a = int(input())
	if a % 5 != 0:
		print('-1')
	elif a % 10 == 0:
		print(a // 10)
	else:
		print(a // 10 + 1)


t = int(input())
for i in range(t):
	x = int(input())
	y = x // 10
	if x % 10 == 0:
		print(y)
	elif x % 5 == 0:
		print(y + 1)
	elif x % 5 != 0:
		print('-1')


t = int(input())
while t > 0:
	t = t - 1
	x = int(input())
	a = x // 10
	b = x % 10
	c = b // 5
	d = b % 5
	if d == 0:
		print(a + c)
	else:
		print('-1')


T = int(input())
for i in range(T):
	x = int(input())
	if x % 10 == 0:
		print(x // 10)
	elif x % 10 != 0 and x % 5 == 0:
		print(x // 10 + 1)
	else:
		print('-1')


for _ in range(int(input())):
	X = int(input())
	if X % 5 == 0:
		if X % 10 == 0:
			print(int(X / 10))
		else:
			print(int((X - 5) / 10 + 1))
	else:
		print(-1)


t = int(input())
for i in range(0, t):
	n = int(input())
	if n % 5 == 0:
		if n % 10 == 0:
			print(n // 10)
		else:
			print(n // 10 + 1)
	else:
		print(-1)


n = int(input())
while n:
	a = int(input())
	if a % 10 == 0:
		print(a // 10)
	if a % 10 == 5:
		print(a // 10 + 1)
	if a % 10 != 0 and a % 10 != 5:
		print(-1)
	n -= 1


t = int(input())
for i in range(t):
	x = int(input())
	if x % 5 != 0 and x % 10 != 0:
		print(-1)
	elif x % 5 == 0 and x % 10 == 0:
		print(x // 10)
	elif x % 5 == 0 or x % 10 == 0:
		print(x // 10 + 1)


def coin(x):
	if x % 10 == 0:
		return x // 10
	elif x % 10 != 0 and x % 5 == 0:
		return x // 10 + 1
	else:
		return '-1'
t = int(input())
for i in range(t):
	x = int(input())
	v = coin(x)
	print(v)


t = int(input())
for i in range(t):
	x = int(input())
	d = x // 10
	c = x % 10 // 5
	e = x % 10 % 5
	if e == 0:
		print(d + c)
	else:
		print(-1)


t = int(input())
for i in range(t):
	a = int(input())
	if a % 5 != 0:
		print(-1)
	else:
		x = a // 5
		y = x // 2 + x % 2
		print(y)


T = int(input())
import math as math
for T in range(0, T):
	X = int(input())
	tens = math.floor(X / 10)
	fives = 0
	wrong = False
	if X % 10 != 0:
		left_over = X - tens * 10
		fives = math.floor(left_over / 5)
		if X % 5 != 0:
			print(-1)
			wrong = True
	if wrong == False:
		print(tens + fives)


for _ in range(int(input())):
	n = int(input())
	x = n // 10
	y = n % 10
	if n % 5 != 0:
		print(-1)
	elif y == 0:
		print(x)
	else:
		print(x + 1)


a = [10, 5]
for i in range(int(input())):
	n = int(input())
	b = 0
	for el in a:
		if el <= n:
			b = b + n // el
			n = n % el
	if n == 0:
		print(b)
	else:
		print(-1)


for i in range(int(input())):
	n = int(input())
	if n % 10 == 0:
		print(n // 10)
	elif n % 10 != 0 and n % 5 == 0:
		print(n // 10 + 1)
	else:
		print('-1')


import math
for i in range(int(input())):
	x = int(input())
	if x % 10 == 0:
		print(math.ceil(x / 10))
	elif x % 5 == 0:
		print(math.ceil(x / 10))
	else:
		print(-1)


n = int(input())
for i in range(n):
	a = int(input())
	x = a % 10
	t = x % 5
	if t == 0:
		k = a // 10 + x // 5
		print(k)
	else:
		print(-1)


test_case = int(input())
for index in range(0, test_case):
	x = int(input())
	y = x % 5
	z = x % 10
	if z == 0:
		print(int(x / 10))
	elif y == 0 or z == 0:
		print(int(x / 10) + 1)
	else:
		print(-1)


import math
t = int(input())
for i in range(t):
	x = int(input())
	a = x / 5
	b = x / 10
	if x % 5 == 0 or x % 10 == 0:
		print(min(math.ceil(a), math.ceil(b)))
	else:
		print(-1)


n = int(input())
for i in range(n):
	a = int(input())
	if a % 5 == 0 or a % 10 == 0:
		if a % 10 == 0:
			print(a // 10)
		else:
			print(abs(a // 5 - a // 10))
	else:
		print('-1')