TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

The kids in my son's kindergarten made Christmas cookies with their teacher, and piled them up in columns. They then arranged the columns so that the tops of the columns, going from shortest to tallest, were in a nice straight ramp. The cookies were all of uniform size. Given that there were A cookies in the shortest pile, that the difference in height between any two adjacent piles was D cookies, and that there were N piles, can you write a program to figure out how many cookies there were in total?

Input Format

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

T <= 100

1 <= N, A, D <=100

Output Format

Output T lines, each line containing the required answer for the corresponding test case.

Sample Input 1

3
1 1 1
3 5 6
2 1 2

Sample Output 1

1
33
4

Hints

In the second test case the sequence is: 5, 11, 17 whose sum is 33.

Problem Source

Migrated from old NTUJ.

Regional Amritapuri 2010

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 65536 200