On Sunday afternoon, the HZAU ACM training room is filled with the sound of keyboards. To reward the students who are working hard on programming problems, Fan Ge decides to order some milk tea from Mixue Bingcheng.
There are $$$n$$$ students in the training room, and Fan Ge needs to buy exactly $$$n$$$ cups of milk tea.
After opening the food delivery app, Fan Ge finds that the shop offers two ways to buy:
Now, please help Fan Ge calculate the minimum amount of money needed to buy exactly $$$n$$$ cups of milk tea.
The input contains multiple test cases.
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$), denoting the number of test cases.
For each test case, one line contains three integers $$$n, a, b$$$ ($$$1 \le n, a, b \le 10^9$$$), representing the required number of cups of milk tea, the price of a single cup, and the price of a couple set, respectively.
For each test case, output one integer representing the minimum cost to buy exactly $$$n$$$ cups of milk tea.
45 2 54 3 45 3 41 10 5
10 8 11 10
In the first test case, the optimal strategy is to buy all cups individually. The minimum cost to buy $$$5$$$ cups is $$$5 \times 2 = 10$$$ yuan. In the second test case, the optimal strategy is to buy $$$2$$$ couple sets. The minimum cost is $$$2 \times 4 = 8$$$ yuan. In the third test case, the optimal strategy is to buy one couple set and one single cup. The minimum cost is $$$2 \times 4 + 1 \times 3 = 11$$$ yuan. In the fourth test case, the minimum cost is $$$10$$$ yuan.