Codeforces Round 938 (Div. 3) |
---|
Finished |
The price of one yogurt at the "Vosmiorochka" store is $$$a$$$ burles, but there is a promotion where you can buy two yogurts for $$$b$$$ burles.
Maxim needs to buy exactly $$$n$$$ yogurts. When buying two yogurts, he can choose to buy them at the regular price or at the promotion price.
What is the minimum amount of burles Maxim should spend to buy $$$n$$$ yogurts?
The first line contains a single integer $$$t$$$ ($$$1 \le t \le {10}^{4}$$$) — the number of test cases.
The first and only line of each test case contains three integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$1 \le n \le 100$$$, $$$1 \le a, b \le 30$$$) — the number of yogurts Maxim wants to buy, the price for one yogurt, and the price for two yogurts on promotion.
For each test case, print in a separate line the minimum cost of buying $$$n$$$ yogurts at "Vosmiorochka".
42 5 93 5 93 5 114 5 11
9 14 15 20
In the third test case of the example, it is more advantageous to buy three yogurts for $$$15$$$ burles than two for $$$11$$$ and one for $$$5$$$.
In the fourth test case of the example, you need to buy four yogurts, each for $$$5$$$ burles.
Name |
---|