#ARC149A. [ARC149A] Repdigit Number

[ARC149A] Repdigit Number

Score : 300300 points

Problem Statement

You are given positive integers NN and MM. Find the maximum positive integer XX that satisfies all of the following conditions.

  • XX is a positive integer less than 10N10^N, and all digits in the decimal representation of XX are the same.
  • XX is a multiple of MM.

If no positive integer XX satisfies the conditions, print -1.

Constraints

  • 1N1051\leq N\leq 10^5
  • 1M1091\leq M\leq 10^9

Input

The input is given from Standard Input in the following format:

NN MM

Output

Print the maximum positive integer XX that satisfies all of the conditions, or -1 if no such positive integer XX exists.

7 12
888888

Four positive integers XX satisfy the conditions: 444,888,444444,888888444, 888, 444444, 888888. The answer is the maximum of them, which is 888888888888.

9 12
888888888

Six positive integers XX satisfy the conditions: 444,888,444444,888888,444444444,888888888444, 888, 444444, 888888, 444444444, 888888888.

1 3
9

Three positive integers XX satisfy the conditions: 3,6,93, 6, 9.

1000 25
-1

No positive integers XX satisfy the conditions.

30 1
999999999999999999999999999999