spoj#AMATH. Another Mathematical Problem
Another Mathematical Problem
Given two numbers n (1<=n<10100) and k (1<=k<=100), you are to determine whether there exists a positive integer T which satisfies that for every positive integer a, na+T-na is divisible by 10k.
Input
Multiple test cases. Each test case contains two space-separated integers n and k. Input terminate by EOF.
The number of test cases will not more than 20.
Output
For each test case, you should output the smallest positive integer number T which satisfies the condition above, or -1 if it doesn't exist.
Example
Input: 32 2</p>Output: 4