atcoder#ABC222G. [ABC222G] 222
[ABC222G] 222
Score : points
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 .
4
1
7
10
999983
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 .