atcoder#ABC157C. [ABC157C] Guess The Number
[ABC157C] Guess The Number
Score : points
Problem Statement
If there is an integer not less than satisfying the following conditions, print the smallest such integer; otherwise, print -1
.
- The integer has exactly digits in base ten. (We assume to be a -digit integer. For other integers, leading zeros are not allowed.)
- The -th digit from the left is .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
3 3
1 7
3 2
1 7
702
satisfies the conditions - its -st and -rd digits are 7
and 2
, respectively - while no non-negative integer less than satisfies them.
3 2
2 1
2 3
-1
3 1
1 0
-1