260A.md (1291B)
1 Source: https://codeforces.com/problemset/problem/260/A 2 3 A. Adding Digits 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 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. 22 23 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. 24 25 Your task is to help Vasya and print the number he can get after applying the lengthening operation to number *a* *n* times. 26 27 Input 28 29 The first line contains three integers: *a*, *b*, *n* (1 ≤ *a*, *b*, *n* ≤ 105). 30 31 Output 32 33 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. 34 35 Examples 36 37 Input 38 39 ``` 40 5 4 5 41 ``` 42 43 Output 44 45 ``` 46 524848 47 ``` 48 49 Input 50 51 ``` 52 12 11 1 53 ``` 54 55 Output 56 57 ``` 58 121 59 ``` 60 61 Input 62 63 ``` 64 260 150 10 65 ``` 66 67 Output 68 69 ``` 70 -1 71 ```