Under construction

Still being built. Things may change

Cookie Piles

Time limit2sMemory limit1024 MB

Summary
Given N cookie piles whose heights start at A and rise by D per pile, find the total number of cookies.
Level

Easy2 of 10

Topics
Math, Implementation
Solved
No attempts yet

Input and Output

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, form a straight ramp. All cookies are the same size. The shortest pile has A cookies, the height difference between any two adjacent piles is D cookies, and there are N piles. Find the total number of cookies.

The figure below shows the second test case, where the piles are 5, 11, and 17 cookies high. Their total is 33.

Input

The first line contains the number of test cases T. Each of the next T lines contains three integers N, A, and D.

Output

For each test case, output the total number of cookies on its own line.

Constraints

  • T ≤ 100
  • 1 ≤ N, A, D ≤ 100

Examples1

  1. Example 1

    Input
    3
    1 1 1
    3 5 6
    2 1 2
    
    Expected output
    1
    33
    4