Codeforces Global Round 27
B
Everyone Loves Tres
Codeforces
900
原题
← AC →
翻译中…

There are 3 heroes and 3 villains, so 6 people in total.

翻译中…

Given a positive integer $n$. Find the smallest integer whose decimal representation has length $n$ and consists only of $3$s and $6$s such that it is divisible by both $33$ and $66$. If no such integer exists, print $-1$.

翻译中…

Input

翻译中…

The first line contains a single integer $t$ ($1\le t\le 500$) — the number of test cases.

翻译中…

The only line of each test case contains a single integer $n$ ($1\le n\le 500$) — the length of the decimal representation.

翻译中…

Output

翻译中…

For each test case, output the smallest required integer if such an integer exists and $-1$ otherwise.

翻译中…

Note

翻译中…

For $n=1$, no such integer exists as neither $3$ nor $6$ is divisible by $33$.

翻译中…

For $n=2$, $66$ consists only of $6$s and it is divisible by both $33$ and $66$.

翻译中…

For $n=3$, no such integer exists. Only $363$ is divisible by $33$, but it is not divisible by $66$.

翻译中…

For $n=4$, $3366$ and $6666$ are divisible by both $33$ and $66$, and $3366$ is the smallest.

翻译中…

样例

Input #1
6
1
2
3
4
5
7
Output #1
-1
66
-1
3366
36366
3336366
InputCopy OutputCopy
题目信息
题号
2035B
时间限制
1 s
内存限制
256 MB
标签
构造
贪心
数学
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。