Codeforces Round 543 (Div. 1, based on Technocup 2019 Final Round)
E
The very same Munchhausen
Codeforces
2600
原题
← DF →
翻译中…

A positive integer $a$ is given. Baron Munchausen claims that he knows such a positive integer $n$ that if one multiplies $n$ by $a$, the sum of its digits decreases $a$ times. In other words, $S(an) = S(n)/a$, where $S(x)$ denotes the sum of digits of the number $x$.

翻译中…

Find out if what Baron told can be true.

翻译中…

Input

翻译中…

The only line contains a single integer $a$ ($2 \le a \le 10^3$).

翻译中…

Output

翻译中…

If there is no such number $n$, print $-1$.

翻译中…

Otherwise print any appropriate positive integer $n$. Your number must not consist of more than $5\cdot10^5$ digits. We can show that under given constraints either there is no answer, or there is an answer no longer than $5\cdot10^5$ digits.

翻译中…

样例

Input #1
2
Output #1
6
InputCopy OutputCopy
Input #2
3
Output #2
6669
InputCopy OutputCopy
Input #3
10
Output #3
-1
InputCopy OutputCopy
题目信息
题号
1120E
时间限制
1 s
内存限制
256 MB
标签
暴力

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