Codeforces Round 777 (Div. 2)
A
Madoka and Math Dad
Codeforces
800
原题
←B →
翻译中…

Madoka finally found the administrator password for her computer. Her father is a well-known popularizer of mathematics, so the password is the answer to the following problem.

翻译中…

Find the maximum decimal number without zeroes and with no equal digits in a row, such that the sum of its digits is $n$.

翻译中…

Madoka is too tired of math to solve it herself, so help her to solve this problem!

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains a single integer $t$ ($1 \le t \le 1000$) — the number of test cases. Description of the test cases follows.

翻译中…

The only line of each test case contains an integer $n$ ($1 \le n \le 1000$) — the required sum of the digits.

翻译中…

Output

翻译中…

For each test case print the maximum number you can obtain.

翻译中…

Note

翻译中…

The only numbers with the sum of digits equal to $2$ without zeros are $2$ and $11$. But the last one has two ones in a row, so it's not valid. That's why the answer is $2$.

翻译中…

The only numbers with the sum of digits equal to $3$ without zeros are $111$, $12$, $21$, and $3$. The first one has $2$ ones in a row, so it's not valid. So the maximum valid number is $21$.

翻译中…

The only numbers with the sum of digits equals to $4$ without zeros are $1111$, $211$, $121$, $112$, $13$, $31$, $22$, and $4$. Numbers $1111$, $211$, $112$, $22$ aren't valid, because they have some identical digits in a row. So the maximum valid number is $121$.

翻译中…

样例

Input #1
5
1
2
3
4
5
Output #1
1
2
21
121
212
InputCopy OutputCopy
题目信息
题号
1647A
时间限制
1 s
内存限制
256 MB
标签
模拟
数学

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