#804. 买水

买水

No submission language available for this problem.

买水

题目描述

ACAC 狗想煮汤,它需要买 nn 升水,附近的商店只有两种类型的瓶装水-一升的和两升的。

一升的瓶装水价格为 aa 元,两升的瓶装水价格为 bb 元,ACAC 狗希望尽可能少花钱,请你帮 ACAC 狗计算购买 nn 升水的最低金额。

输入格式

每个测试包含多个测试用例。

第一行包含测试用例的数量为 TT (1T5001 \le T \le 500)。测试用例的描述如下。

每个测试用例的一行包含三个整数 nnaabb。(0<n10120 < n \le 10^{12}1a,b1031 \le a,b \le 10^3)

输出格式

对于每个测试用例,输出购买 nn 升水的最低金额。

样例 #1

样例输入 #1

4
10 1 3
7 3 2
1 1000 1
1000000000000 42 88

样例输出 #1

10
9
1000
42000000000000

Background

Special for beginners, ^_^

Description

Given two integers x and y, print the sum.

Format

Input

Two integers x and y, satisfying 0x,y327670\leq x,y\leq 32767 .

Output

One integer, the sum of x and y.

Samples

123 500
623

Limitation

1s, 1024KiB for each test case.