from sys import stdin,stdout
input = lambda:stdin.readline().strip()
for _ in range(int(input())):
x = input()
len1 = len(x)-1
s = int(x[0])
if s == 1:
p = "2"
elif s == 2:
p = "3"
elif s == 3:
p = "5"
elif s == 4:
p = "7"
elif s == 5:
p = "7"
elif s == 6:
p = "7"
elif s == 7:
p = "11"
elif s == 8:
p = "11"
elif s == 9:
p = "11"
stdout.write(p+"0"*len1+"\n")

京公网安备 11010502036488号