#D7800. Heat Strokes
Heat Strokes
Heat Strokes
We have had record hot temperatures this summer. To avoid heat stroke, you decided to buy a quantity of drinking water at the nearby supermarket. Two types of bottled water, 1 and 0.5 liter, are on sale at respective prices there. You have a definite quantity in your mind, but are willing to buy a quantity larger than that if: no combination of these bottles meets the quantity, or, the total price becomes lower.
Given the prices for each bottle of water and the total quantity needed, make a program to seek the lowest price to buy greater than or equal to the quantity required.
Input
The input is given in the following format.
The first line provides the prices for a 1-liter bottle (), 500-milliliter bottle (), and the total water quantity needed (). All these values are given as integers, and the quantity of water in milliliters.
Output
Output the total price.
Examples
Input
180 100 2400
Output
460
Input
200 90 2018
Output
450
inputFormat
Input
The input is given in the following format.
The first line provides the prices for a 1-liter bottle (), 500-milliliter bottle (), and the total water quantity needed (). All these values are given as integers, and the quantity of water in milliliters.
outputFormat
Output
Output the total price.
Examples
Input
180 100 2400
Output
460
Input
200 90 2018
Output
450
样例
180 100 2400
460