Company: Walmart_12march
Difficulty: medium
Momo Purchase Problem Description A shop sells Momo and you may choose to buy the Momos according to the pricing scheme given below: The cost of one Momo for rupees X The cost of three Momos for rupees Y How much rupees do you need to pay to obtain exactly N Momo? Input Format Input: The input consists of three space separated integers X, Y and N which represent the price of 1 Momo, price of 3 Momos and the number of Momos you are required to buy. Output Format Output: Print the amount you need to pay as a single integer. Constraints 1 ≤ X ≤ Y ≤ 10 9 1 ≤ N ≤ 10 9 All values in input are integers. Examples Example 1: Input: 10 25 10 Output: 85 Explanation: You can buy three Momos for Rs 25 for three times and one Momo for Rs 10 for one time, and you will obtain exactly 10 Momo for a total of Rs 85. You cannot obtain exactly 10 Momo for a lower cost, so the answer is Rs 85 Example 2: Input: 10 40 10 Output: 100 Explanation: You can buy 10 Momo for Rs 10 each, and you will