Chef Two and Chef Ten are playing a game with a number $X$. In one turn, they can multiply $X$ by $2$. The goal of the game is to make $X$ divisible by $10$.
Help the Chefs find the smallest number of turns necessary to win the game (it may be possible to win in zero turns) or determine that it is impossible.

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first and only line of each test case contains a single integer denoting the initial value of $X$. 

-----Output-----
For each test case, print a single line containing one integer — the minimum required number of turns or $-1$ if there is no way to win the game.

-----Constraints-----
- $1 \le T \le 1000$
- $0 \le X \le 10^9$

-----Subtasks-----
Subtask #1 (100 points): original constraints

-----Example Input-----
3
10
25
1

-----Example Output-----
0
1
-1

Difficulty: EASY

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


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


T = int(input())
for i in range(T):
	x = int(input())
	if x % 5 != 0:
		print(-1)
	else:
		for i in range(999):
			if x * 2 ** i % 10 == 0:
				print(i)
				break


T = int(input())
for i in range(T):
	X = int(input())
	result = X * 2
	if X % 10 == 0:
		print(0)
	elif result % 10 == 0:
		print(1)
	else:
		print(-1)


try:
	for t in range(int(input())):
		x = int(input())
		count = -1
		if x % 10 == 0:
			count += 1
		elif x % 5 == 0:
			count = 1
		else:
			count = -1
		print(count)
except:
	pass


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


n = int(input())
for i in range(n):
	ele = int(input())
	if ele % 10 == 0:
		print(0)
	else:
		ele *= 2
		if ele % 10 == 0:
			print(1)
		else:
			print(-1)


t = int(input())
for i in range(t):
	x = int(input())
	if x % 10 == 0:
		print(0)
	elif x * 2 % 10 == 0:
		print(1)
	else:
		print(-1)


T = int(input())
for i in range(T):
	X = int(input())
	count = 0
	if X % 5 == 0:
		while X % 10 != 0:
			X *= 2
			count += 1
	else:
		count = -1
	print(count)


T = int(input())
for i in range(T):
	N = int(input())
	n = 0
	if N % 10 == 0:
		print(0)
	elif N % 5 == 0:
		print(1)
	else:
		print(-1)


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


t = int(input())
for _ in range(t):
	num = int(input())
	if num % 5 != 0:
		print(-1)
		continue
	count = 0
	while True:
		if num % 10 == 0:
			break
		num *= 2
		count += 1
	print(count)


t = int(input())
for z in range(t):
	x = int(input())
	if x % 10 == 0:
		print(0)
	elif x % 5 == 0:
		print(1)
	else:
		print(-1)


t = int(input())
for ss in range(t):
	n = int(input())
	c = 0
	if n % 10 == 0:
		c = 1
		print(0)
	elif n % 10 != 0:
		for i in range(1, 11):
			if n * 2 ** i % 10 == 0:
				c = 1
				print(i)
				break
	if c == 0:
		print(-1)


for t in range(int(input())):
	a = int(input())
	b = a * 2
	if a % 10 == 0:
		print(0)
	elif a % 10 == 5:
		print(1)
	else:
		print(-1)


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


from math import gcd
t = int(input())
for i in range(t):
	n = int(input())
	if n % 5 == 0 and n % 10 != 0:
		print('1')
	elif n % 10 == 0:
		print('0')
	else:
		print('-1')


for i in range(int(input())):
	a = input()
	if a[-1] == '5':
		print(1)
	elif a[-1] == '0':
		print(0)
	else:
		print(-1)


n = int(input())
for i in range(n):
	a = int(input())
	if a % 10 == 0:
		print('0')
	else:
		c = 0
		a = a * 2
		if a % 10 == 0:
			c += 1
			print(c)
		else:
			print('-1')


test_case = int(input())
for i in range(test_case):
	num = int(input())
	if num % 10 == 0:
		print('0')
	elif num * 2 % 10 == 0:
		print('1')
	else:
		print('-1')


try:
	t = int(input())
	for r in range(t):
		x = int(input())
		if x % 10 == 0:
			print(0)
		elif x % 10 != 0:
			if x * 2 % 10 == 0:
				print(1)
			else:
				print(-1)
except:
	pass


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


t = int(input())
while t > 0:
	X = int(input())
	if X % 10 == 0:
		print(0)
	else:
		X = X * 2
		if X % 10 == 0:
			print(1)
		else:
			print(-1)
	t = t - 1


t = int(input())
for _ in range(t):
	x = int(input())
	if x % 5 == 0:
		if x % 2 == 0:
			print(0)
		else:
			print(1)
	else:
		print(-1)


for _ in range(int(input())):
	x = int(input())
	if x % 10 == 0:
		print(0)
	elif x % 10 != 0:
		if x * 2 % 10 == 0:
			print(1)
		else:
			print(-1)


for _ in range(int(input())):
	x = int(input())
	temp = 0
	while x % 10 != 0:
		x = x * 2
		temp += 1
		if temp >= 10:
			temp = -1
			break
	print(temp)


for i in range(int(input())):
	n = int(input())
	if n % 5 == 0:
		c = 0
		while n % 10 != 0:
			n *= 2
			c += 1
		print(c)
	else:
		print(-1)


for t in range(int(input())):
	X = int(input())
	C = 0
	if X % 5 != 0:
		print('-1')
	elif X % 10 == 0:
		print('0')
	else:
		while X % 10 != 0:
			X *= 2
			C += 1
		print(C)


T = int(input())
for i in range(T):
	x = int(input())
	if x % 5 == 0:
		c = 0
		while x % 10 != 0:
			x = x * 2
			c += 1
		print(c)
	else:
		print(-1)


for _ in range(int(input())):
	X = int(input())
	if X % 10 == 0:
		print(0)
	elif X % 10 == 5:
		print(1)
	elif (X % 10 % 2 == 0 or X % 10 % 2 != 0) and (X % 10 != 0 and X % 10 != 5):
		print(-1)


for testcases in range(int(input())):
	number = int(input())
	if number % 10 == 0:
		print(0)
	elif number % 5 == 0:
		print(1)
	else:
		print(-1)


for _ in range(int(input())):
	num = int(input())
	steps = 0
	if num % 10 == 0:
		print(0)
	elif num % 5 == 0:
		print(1)
	else:
		print(-1)


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


t = int(input())
for i in range(t):
	a = int(input())
	count = 0
	if a % 10 == 0:
		print(0)
	elif a % 10 != 0 and a % 5 == 0:
		for i in range(100):
			a = a * 2
			count += 1
			if a % 10 == 0:
				break
			else:
				continue
		print(count)
	else:
		print(-1)


n = int(input())
for i in range(n):
	a = int(input())
	if a % 5 == 0 and a % 2 == 0:
		print(0)
	elif a % 5 == 0 and a % 2 != 0 and (a != 1):
		print(1)
	else:
		print(-1)


for tc in range(int(input())):
	x = int(input())
	n = x % 10
	if n == 0:
		print('0')
	elif n == 5:
		print('1')
	else:
		print('-1')


n = int(input())
for i in range(n):
	j = int(input())
	count = 0
	if j % 10 == 0:
		print(count)
	else:
		j = j * 2
		if j % 10 == 0:
			count = count + 1
			print(count)
		else:
			print('-1')


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


t = int(input())
while t > 0:
	x = int(input())
	if x % 10 == 0:
		print(0)
	elif x % 5 == 0:
		print(1)
	else:
		print(-1)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	if n % 5 != 0:
		print(-1)
	for i in range(100):
		if n * pow(2, i) % 10 == 0:
			print(i)
			break