#abc222g. [abc222_g]222

[abc222_g]222

Problem Statement

We have a sequence 2,22,222,2222,ldots2,22,222,2222,\\ldots, where the ii-th term is an ii-digit integer whose digits are all 22.

Where does a multiple of KK appear in this sequence for the first time? If the first multiple of KK is the xx-th term of the sequence, print xx; if there is no multiple of KK, print -1.

Given TT cases, solve each of them.

Constraints

  • 1leqTleq2001 \\leq T \\leq 200
  • 1leqKleq1081 \\leq K \\leq 10^8
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

TT textcase1\\text{case}_1 textcase2\\text{case}_2 vdots\\vdots textcaseT\\text{case}_T

Each case is in the following format:

KK

Output

Print TT lines. The ii-th line should contain the answer for textcasei\\text{case}_i.


Sample Input 1

4
1
7
10
999983

Sample Output 1

1
6
-1
999982

We have four cases.

  • 22 is a multiple of 11.
  • None of 2,22,222,2222,222222,22,222,2222,22222 is a multiple of 77, but 222222222222 is.
  • None of 2,22,ldots2,22,\\ldots is a multiple of 1010.