361. Cookie Piles

0

Easy

The teacher and kids in a kindergarten class made Christmas cookies and stacked them in columns. They arranged the columns in a straight ramp, with the shortest pile at the beginning and each subsequent pile being D cookies taller than the previous one. All the cookies are the same size. Given the number of piles N, the number of cookies in the shortest pile A, and the height difference between adjacent piles D, write a program to calculate the total number of cookies.

Input Format

The first line of input contains the number of test cases T. T lines follow, each corresponding to a test case and containing three integers: N, A, and D.

Output Format

Output T lines, each line containing the total number of cookies for the corresponding test case.

Example

Input

3 1 1 1 3 5 6 2 1 2

Output

1 33 4

Constraints

T <= 100000
1 <= N, A, D <=100
Loading...

View Submissions

Console