Vasya has got two number: a and b. However, Vasya finds number a too short. So he…
- User
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
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 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.
Examples
Input
5 4 5
Output
524848
Input
12 11 1
Output
121
Input
260 150 10
Output
-1
Assistant
pythona, b, n = map(int, input().split()) current_mod = a % b result = str(a) for _ in range(n): found = False # Try to find a digit that makes the new_mod zero for d in range(10): if (current_mod * 10 + d) % b == 0: result += str(d) current_mod = 0 result += '0' * (n - _ - 1) print(result) exit() # If not found, append the first possible digit and continue for d in range(10): new_mod = (current_mod * 10 + d) % b result += str(d) current_mod = new_mod found = True break if not found: print(-1) exit() # After all steps, check if the final number is divisible by b print(result if current_mod == 0 else -1)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.