#CF1107B. Good times Good times 美好时光

Good times Good times 美好时光

当前没有测试数据。

CF测试跳转:https://codeforces.com/contest/2241/problem/B

An integer nn is said to be good if it contains at most two distinct digits in its decimal representation. For example, the integers 33, 85888588, 6767 are good, whereas the integers 123123, 94479447 are not.

You are given an integer xx (1x<1081 \le x \lt 10^8), which is good. Your task is to find an integer yy (2y1092 \le y \le 10^9) such that both of the following conditions are satisfied:

  • yy is good.
  • x×yx \times y is good.

Input

The first line contains an integer tt (1t1041 \le t \le 10^4) — the number of test cases. The description of each test case follows.

Each test case contains a single integer xx (1x<1081 \le x \lt 10^8). It is guaranteed that xx is good.

Output

For each test case, print a single integer yy (2y1092 \le y \le 10^9) such that both the integers yy and x×yx \times y are good.

If there are multiple valid answers, output any one of them.

Exammple

4
8
73
299
6767
11
4
26
3366

Note

For the first test case, we have x=8x = 8; choosing y=11y = 11 is valid because both y=11y = 11 and x×y=88x \times y = 88 are good.

For the second test case, we have x=73x = 73; choosing y=4y = 4 is valid because both y=4y = 4 and x×y=292x \times y = 292 are good.