Chef has a number N, Cheffina challenges the chef to check the divisibility of all the permutation of N by 5. If any of the permutations is divisible by 5 then print 1 else print 0.

-----Input:-----
- First-line will contain $T$, the number of test cases. Then the test cases follow. 
- Each test case contains a single line of input,$N$. 

-----Output:-----
For each test case, output in a single line answer 1 or 0.

-----Constraints-----
- $1 \leq T \leq 10^6$
- $1 \leq N \leq 10^6$

-----Sample Input:-----
2
19
385

-----Sample Output:-----
0
1

Difficulty: UNKNOWN_DIFFICULTY

Starter code:

Solutions:
a = int(input())
for i in range(a):
	b = input()
	if '5' in b or '0' in b:
		print(1)
		continue
	print(0)


t = int(input())
while t:
	n = input()
	if '0' in n or '5' in n:
		print('1')
	else:
		print('0')
	t = t - 1


t = int(input())
for t1 in range(t):
	n = input()
	a = 0
	for i in n:
		if i == '0' or i == '5':
			a = 1
			break
	print(a)


from sys import *
input = stdin.readline
for i in range(int(input())):
	n = int(input())
	while n > 0:
		r = n % 10
		if r % 5 == 0:
			print(1)
			break
		n = n // 10
	else:
		print(0)


T = int(input())
for _ in range(T):
	N = input()
	if '0' in N or '5' in N:
		print(1)
	else:
		print(0)


from sys import *
input = stdin.readline
t = int(input())
for _ in range(t):
	s = list(input())
	n = s.count('0') + s.count('5')
	if n > 0:
		print('1')
	else:
		print('0')


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


for i in range(int(input())):
	n = int(input())
	n = str(n)
	z = n.find('5')
	z1 = n.find('0')
	if z == -1 and z1 == -1:
		print('0')
	else:
		print('1')


for _ in range(int(input())):
	n = input()
	if '5' in n or '0' in n:
		print(1)
	else:
		print(0)


n = int(input())
ls = []
for _ in range(n):
	ls.append(int(input()))
for ele in ls:
	ele = str(ele)
	ele = list(ele)
	flag = 0
	for i in ele:
		if int(i) % 5 == 0:
			print('1')
			flag = 1
			break
	if flag == 0:
		print('0')


def f(n):
	string = str(n)
	for char in string:
		if char in '05':
			return 1
	return 0
t = int(input())
answers = list()
for _ in range(t):
	n = int(input())
	answers.append(f(n))
for answer in answers:
	print(answer)


for _ in range(int(input())):
	n = int(input())
	a = str(n)
	if a.count('0') or a.count('5'):
		print('1')
	else:
		print('0')


for _ in range(int(input())):
	n = input()
	flag = 0
	for i in n:
		if i == '0' or i == '5':
			flag = 1
			break
	if flag == 0:
		print('0')
	else:
		print('1')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = input()
	for i in range(len(n)):
		if n[i] == '0' or n[i] == '5':
			print('1')
			break
	else:
		print('0')


for _ in range(int(input())):
	l = list(input())
	if '0' in l or '5' in l:
		print(1)
	else:
		print(0)


for i in range(int(input())):
	num = input()
	if '5' in num or '0' in num:
		print(1)
	else:
		print(0)


def func(num):
	for x in num:
		if x == '0' or x == '5':
			print(1)
			return
	print(0)
for _ in range(int(input())):
	num = input()
	func(num)


t = int(input())
for i in range(t):
	n = input()
	if '0' in n or '5' in n:
		print(1)
	else:
		print(0)


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
inp = lambda : list(map(int, sys.stdin.readline().rstrip('\r\n').split()))
tc = 1
(tc,) = inp()
for _ in range(tc):
	(n,) = inp()
	print(1 if any([int(i) % 5 == 0 for i in str(n)]) else 0)