3757.Adding Digits

Time Limit: 1s Memory Limit: 256MB

Vasya has got two number: a and b. However, Vasya 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 Vasya's number 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 Vasya and print the number he can get after applying the lengthening operation to number a n times.

Input Format(From the terminal/stdin)

The first line contains three integers: a,b,n (1 \le a,b,n \le 105).

Output Format(To the terminal/stdout)

In a single line print the integer without leading zeros, which Vasya can get when he applies the lengthening operations to number a n times. If no such number exists, then print number -1. If there are multiple possible answers, print any of them.

Sample Input 1

Copy
5 4 5
 · · \n

Sample Output 1

Copy
524848
      \n

Sample Input 2

Copy
12 11 1
  ·  · \n

Sample Output 2

Copy
121
   \n

Sample Input 3

Copy
260 150 10
   ·   ·  \n

Sample Output 3

Copy
-1
  \n

Submit

请先 登录

© 2025 FAQs