Arrow is getting paranoid about Malcom merlyn, his arch-enemy. All his efforts to subdue Merlyn have been in vain. These days Arrow is working on a problem with John Diggle. Diggle mentioned that the Felicity has been facing weird problem with their supercomputer, 'The ECHELON', recently.

This afternoon, Arrow received a note from Merlyn, Saying that he has infected 'The ECHELON' with a virus. Moreover, the note had the number X printed on it. After doing some calculations, Arrow's friend Felicity figured out that the key to remove the virus is the largest Decent Number having X digits.

A Decent Number has the following properties:

3, 5 or both as its digits. No other digit is allowed.

Number of times 3 appears is divisible by 5.

Number of times 5 appears is divisible by 3.

Meanwhile, the counter to the destruction of 'The ECHELON' is running very fast. Can you save 'The ECHELON', and find the key before Arrow's friend Felicity?

Input Format

The 1st line will contain an integer T, the number of test cases. This is followed by T lines, each containing an integer X. i.e. the number of digits in the number.

Output Format

Largest Decent Number having X digits. If no such number exists, tell Arrow that he is wrong and print -1.

Constraints

1 ≤ T ≤ 20
1 ≤ X ≤ 100000

SAMPLE INPUT
4
1
3
5
11

SAMPLE OUTPUT
-1
555
33333
55555533333

Explanation

For N=1, there is no such number.
For N=3, 555 is the only possible number.
For N=5, 33333 is the only possible number.
For N=11, 55555533333 and all permutations of these digits are valid numbers; among them, the given number is the largest one.
t=input()
for i in range(0,t):
	n=input()
	if(n%3==0):
		s="5"*n
		print s
	else:
		if((n-5)%3==0 and (n-5)>=0):
			s="5"*(n-5)
			s=s+"3"*5
			print s
		else:
			k=5
			cnt=1
			f=0
			while(((n-k)%3)!=0):
				cnt=cnt+1
				k=5*cnt
				if(k<=n):
					f=1
				else:
					f=0
			if(f==0):
				print -1
			else:
				s="5"*(n-k)
				s=s+"3"*k
				print s