Problem: In vardhaman college of engineering, there is competition with name treasure lock.
To make this competition the key for the lock should satisfy following rules.
1 .3, 5, or both as its digits. No other digit is allowed.
2. Number of times 3 appears is divisible by 5.
3. Number of times 5 appears is divisible by 3.

Rakesh is very eager to win the championship. He is developing a code for that key.Assume yourself in that situation and solve for the key.

INPUT:
first line contains T testcases.
Next T lines consists of the number.
OUTPUT:
Output the number satisfying the above conditions.
if n cannot satisfy the above conditions print -1.

0<t<10
0<n<1000

SAMPLE INPUT
4
1
3
5
17

SAMPLE OUTPUT
-1
555
33333
55555555555533333

Solution (in PYTHON):

Solution:
def f(n):
	a=1
	b=0
	c=1
	x=[]
	while True:
		#print a,b
		if 5*a+3*b==n:
			x=[c,a,b]
			return x
			break
		else:
			b+=1
			if (5*a+3*b)>n:
				break
	a,b,c=0,1,2
	x=[]
	while True:
		#print a,b
		if 5*a+3*b==n:
			x=[c,a,b]
			return x
			break
		else:
			a+=1
			if (5*a+3*b)>n:
				break	
	return -1
for _ in xrange(input()):
	n=input()
	if n<3:
		print "-1"
		continue
	if n==3 or n%3==0:
		print "5"*n
		continue
	if n==5 or n%5==0:
		print "3"*n
		continue
	x=[]
	x=f(n)
	#print x
	if x!=-1:
		if x[0]==1:
			print "5"*(3*x[2])+"3"*(5*x[1])
		else:
			print "5"*(3*x[1])+"3"*(5*x[2])