题目描述
Problem Description
A store sells notebooks in two types of packages: the first type is a single notebook for $x$ yuan, and the second type is a ten-pack with a discount, priced at $y$ yuan.
The store has launched a "Double Eleven" promotion where each package is discounted by 1 yuan. After the discount, the single notebook costs $x - 1$ yuan, and the ten-pack costs $y - 1$ yuan.
Xiao Ming wants to buy exactly $n$ notebooks. How much money does he need to spend at least?
Note: "Exactly" means that Xiao Ming cannot buy fewer than $n$ notebooks or more than $n$ notebooks.
Input Format
A single line containing three numbers $x, y, n$, representing the price of a single notebook, the price of a ten-pack, and the number of notebooks Xiao Ming needs, respectively.
Output Format
A single number representing the minimum amount of money Xiao Ming needs to spend to buy $n$ notebooks.
Sample Input and Output
Sample Input #1
10 80 10
Sample Output #1
79
Sample Input #2
10 80 11
Sample Output #2
88
Sample Input #3
10 80 1
Sample Output #3
9
Notes
Sample Explanation:
The original price of a single notebook is $10$ yuan, and the original price of a ten-pack is $80$ yuan.
After the discount, the price of a single notebook is $9$ yuan, and the price of a ten-pack is $79$ yuan.
At this time, if Xiao Ming buys $10$ notebooks, he needs $79$ yuan; if he buys $1$ notebook, he needs $9$ yuan; if he buys $11$ notebooks, he needs $88$ yuan.
Data Range:
For $20\%$ of the data, $n < 10$;
For another $20\%$ of the data, $n$ is a multiple of $10$;
For $80\%$ of the data, $0 \le n, x, y \le 10^4$;
For $100\%$ of the data, $0 \le n, x, y \le 10^9$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分