QOJ.ac

QOJ

Limite de temps : 2 s Limite de mémoire : 1024 MB Points totaux : 100 Hackable ✓

#17941. Chocolate and 11 and Palindrome

Statistiques

Coco has many chocolates with digits from $0$ to $9$ engraved on them. Coco wants to make a large number using these chocolates to give as a gift to Hanbyeol.

Since Coco knows that Hanbyeol likes palindrome numbers, especially $11$, she wants to create a palindrome number that is a multiple of $11$. A palindrome number is a number that reads the same from left to right and from right to left. For example, $9$, $11$, $4774$, and $13531$ are palindrome numbers, while $1232$ and $1100$ are not.

Help Coco find an $N$-digit non-negative integer that is both a multiple of $11$ and a palindrome. Assume there are enough chocolates for each digit. A number other than $0$ cannot start with the digit $0$.

Input

The first line contains the number of test cases $T$. $(1 \le T \le 100)$

For each test case, a positive integer $N$ is given on a single line. $(1 \le N \le 10\,000)$

Output

For each test case, output an $N$-digit non-negative integer that is a multiple of $11$ and a palindrome on a single line. If there are multiple answers, output any one of them. If no such number exists, output -1 instead.

Examples

Input 1

2
4
9

Output 1

1331
123444321

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.