eolymp
bolt
Try our new interface for solving problems

Buns

Huseyn likes buns very much, which are sold at ADA University in building C. It is known that \begin{itemize} \item you can buy one bun for $a$ qəpiks; \item you can buy three buns for $b$ qəpiks; \end{itemize} Huseyn wants to buy exactly $n$ buns. What is the least number of qəpiks he should spend? \InputFile Three positive integers $a, b$ and $n$, each is not greater than $10^9$. \OutputFile Print the least amount of qəpiks that Huseyn should spend to buy exactly $n$ buns.
Time limit 1 second
Memory limit 128 MiB
Input example #1
2 5 10
Output example #1
17
Author Mykhailo Medvediev