#abc222g. [abc222_g]222
[abc222_g]222
Problem Statement
We have a sequence , where the -th term is an -digit integer whose digits are all .
Where does a multiple of appear in this sequence for the first time? If the first multiple of is the -th term of the sequence, print ; if there is no multiple of , print -1
.
Given cases, solve each of them.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Each case is in the following format:
Output
Print lines. The -th line should contain the answer for .
Sample Input 1
4
1
7
10
999983
Sample Output 1
1
6
-1
999982
We have four cases.
- is a multiple of .
- None of is a multiple of , but is.
- None of is a multiple of .