3105: Largest Integer

时间限制:1000 ms 内存限制:128 MB
上传者:
提交:78 通过:29

题目描述

You have an electronic screen which can display decimal digits. Each decimal digit is composed of 7 segments which can be turned on and off. So you can use these 7 segments to combine into different decimal digits. The following picture describes how you can display all 10 decimal digits.

As you can see, different digits may require different number of segments to be turned on. For example, if you want to display 1, you have to turn on 2 segments of the screen, and if you want to display 8, all 7 segments should be turned on.

Assuming that you can only turn on no more than n segments at the same time, what is the largest positive integer you can display?

Note that you need to solve $T$ test cases.

输入格式

The first line contains an integer $T(1\leq T\leq 1000)$ —— the number of test cases you need to solve.

The only line of each test case contains a integer $n(1\leq n\leq 2*10^6)$ —— the maximum number of segments that can be turned on.

It is guaranteed that the sum of $n$ over all test cases does not exceed $2*10^6$.

输出格式

An integer that represents the number of sub-matrixes that satisfy the meaning of the question.For each test case, If you can't display any positive integer, print -1, otherwise, print the largest positive integer you can display in one line.

输入样例 复制

3
1
4
7

输出样例 复制

-1
11
711