#CF2230A. A. Optimal Purchase

A. Optimal Purchase

A. Optimal Purchase

You have a group of nn students who need access to an online course. Two types of access keys are available in the store:

  1. Individual key: costs aa dollars and gives access to one student.
  2. Group key: costs bb dollars and gives access to a group of up to three students inclusive. A group key can also be used for fewer students (one or two), and its price does not change.

Your task is to determine the minimum amount of money needed to provide access to the online course for all nn students.

The first line contains one integer tt (1t1041 \le t \le 10^4) — the number of test cases.

Each test case consists of one line containing three integers n,a,bn, a, b (1n,a,b1081 \le n, a, b \le 10^8) — the number of students, the cost of an individual key, and the cost of a group key.

For each test case, output one integer — the minimum amount of money needed to provide access to the online course for all nn students.

ExampleNoteIn the first example, you can buy 11 group key and 22 individual keys.

In the second example, you can buy 44 individual keys.

In the third example, you can buy 11 group key.

In the fourth example, you can buy 11 individual key.

Input

InputThe first line contains one integer tt (1t1041 \le t \le 10^4) — the number of test cases.

Each test case consists of one line containing three integers n,a,bn, a, b (1n,a,b1081 \le n, a, b \le 10^8) — the number of students, the cost of an individual key, and the cost of a group key.

Output

OutputFor each test case, output one integer — the minimum amount of money needed to provide access to the online course for all nn students.

Samples

5
5 10 25
4 10 50
1 20 15
2 10 1
3 1 1
45
40
15
1
1

Note

NoteIn the first example, you can buy 11 group key and 22 individual keys.

In the second example, you can buy 44 individual keys.

In the third example, you can buy 11 group key.

In the fourth example, you can buy 11 individual key.