0.1 Gamer's Challenge

Score: 10pts

Time Limit: 5.00 sec

Max, an avid gamer, is on the verge of completing a captivating video game. With sheer determination, he aims to conquer the remaining X levels in a single relentless session. Each level demands Y minutes for Max's adept gameplay. However, in his pursuit of victory, Max's acknowledges the importance of safeguarding his eyesight. Hence, he institutes a practice wherein he pauses for a strategic break of Z minutes every time he successfully clears 3 levels. Notably, this breather is forgone once he completes the entire game.

Calculate the total time, in minutes, that Max will expend to successfully accomplish the game under these conditions. Provide your answer in terms of X, Y, and Z.

Note: Assume that Max's starts playing from the beginning of the game and that his breaks are only taken after completing groups of 3 levels. Disregard any additional factors that might affect gameplay time.

Calculate the total time, in minutes, that Max will expend to successfully accomplish the game under these conditions. Provide your answer in terms of X, Y, and Z.

Note: Assume that Max's starts playing from the beginning of the game and that his breaks are only taken after completing groups of 3 levels. Disregard any additional factors that might affect gameplay time.

Constraints

1≤T≤100

1≤X≤100

5≤Y≤100

5≤Z≤15

1≤X≤100

5≤Y≤100

5≤Z≤15

Input Format

The first line of input will contain a single integer T, denoting the number of test cases.

The first and only line of input will contain three space-separated integers X,Y, and Z.

The first and only line of input will contain three space-separated integers X,Y, and Z.

Output Format

For each test case, output on a new line the answer - the length of Max's gaming session.

Example 1

Input:

4

2 12 10

3 12 10

7 20 8

24 45 15

Output:

24

36

156

1185

Explanation:

Test case 1:

here value of x=2,y=12 and z=10 so as x is less then 3 so no relation is needed so answer will be 2*12 i.e 24.

Test case 2:

here x=3,y=12 and z=10 so as gamer can play consecutively 3 games so no break is required so answer would be 3*12 i.e 36.

Test case 3:

here x=7,y=20 and z=8 so gamer can play 3 levels then take a break and then after that play more 3 levels then take a break and then play one level left so answer is 7(levels)*20+2(breaks)*8=140+16=156.

4

2 12 10

3 12 10

7 20 8

24 45 15

Output:

24

36

156

1185

Explanation:

Test case 1:

here value of x=2,y=12 and z=10 so as x is less then 3 so no relation is needed so answer will be 2*12 i.e 24.

Test case 2:

here x=3,y=12 and z=10 so as gamer can play consecutively 3 games so no break is required so answer would be 3*12 i.e 36.

Test case 3:

here x=7,y=20 and z=8 so gamer can play 3 levels then take a break and then after that play more 3 levels then take a break and then play one level left so answer is 7(levels)*20+2(breaks)*8=140+16=156.