AtCoder Regular Contest 149
A
Repdigit Number
AtCoder
⌀ 878
原题
←B →
翻译中…

Problem Statement

翻译中…

You are given positive integers $N$ and $M$. Find the maximum positive integer $X$ that satisfies all of the following conditions.

翻译中…
  • $X$ is a positive integer less than $10^N$, and all digits in the decimal representation of $X$ are the same.
  • $X$ is a multiple of $M$.
翻译中…

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

翻译中…

Constraints

翻译中…
  • $1\leq N\leq 10^5$
  • $1\leq M\leq 10^9$
翻译中…

Input

翻译中…

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

翻译中…

N M

翻译中…

Output

翻译中…

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

翻译中…

样例

Input #1
7 12
Output #1
888888
Four positive integers $X$ satisfy the conditions: $444, 888, 444444, 888888$. The answer is the maximum of them, which is $888888$.
Input #2
9 12
Output #2
888888888
Six positive integers $X$ satisfy the conditions: $444, 888, 444444, 888888, 444444444, 888888888$.
Input #3
1 3
Output #3
9
Three positive integers $X$ satisfy the conditions: $3, 6, 9$.
Input #4
1000 25
Output #4
-1
No positive integers $X$ satisfy the conditions.
Input #5
30 1
Output #5
999999999999999999999999999999
题目信息
题号
arc149_a
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。