Submit | All submissions | Best solutions | Back to list |
Problem hidden
ADD00 - Keep On Adding |
RAJA has got two number: a and b. However, Raja finds number a too short. So he decided to repeat the operation of lengthening number a n times.
One operation of lengthening a number means adding exactly one digit to the number (in the decimal notation) to the right provided that the resulting number is divisible by b. If it is impossible to obtain the number which is divisible by b, then the lengthening operation cannot be performed.
Your task is to help Raja and print the number he can get after applying the lengthening operation to number a n times.
Input
The first line contains three integers: a, b, n (1 ≤ a, b, n ≤ 105).
Output
In a single line print the integer without leading zeros, which Raja can get when he applies the lengthening operations to number a ntimes. If no such number exists, then print number -1. If there are multiple possible answers, print one which has smallest possible value with largest number of zeros .
Example
Input:5 4 5Output:520000
Added by: | dazzler |
Date: | 2017-07-30 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | Euphorian palace |