Day8 - E - The very same Munchhausen CodeForces - 1120E
A positive integer aa is given. Baron Munchausen claims that he knows such a positive integer nn that if one multiplies nn by aa, the sum of its digits decreases aa times. In other words, S(an)=S(n)/aS(an)=S(n)/a, where S(x)S(x) denotes the sum of digits of the number xx.
Find out if what Baron told can be true.
Input
The only line contains a single integer aa (2≤a≤1032≤a≤103).
Output
If there is no such number nn, print −1−1.
Otherwise print any appropriate positive integer nn. Your number must not consist of more than 5⋅1055⋅105 digits. We can show that under given constraints either there is no answer, or there is an answer no longer than 5⋅1055⋅105 digits.
Examples
Input
2
Output
6
Input
3
Output
6669
Input
10
Output
-1
题解都不懂的大坑