In a country, there are only 2 currency denominations x and y. z is the bill amount.
Write a function to minimize the amount a person has to pay as tip with the bill. As there is no denomination less than x and y, any amount paid above z is considered tip
Input: x, y, z Output: k or "Error..." (where k is the tip amount)
Example 1
Input: 2, 5, 109 Output: 0 Explanation: 21 coins of 5, and 2 coins of 2
Example 2
Input: 5, 7, 43 Output: 0 Explanation: 4 coins of 7, and 3 coins of 5
Example 3
Input: 15, 19, 33 Output: 1 Explanation: 1 coin of 15 and 1 coin of 19