# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

# Ator Ali's Income

By shajia · Limits 1s, 512 MB

Ator Ali loves to make money. He does not care whether his source of income is good or evil. As his intention is not clear, he can not find any honest way to make the money. As a result, all his income sources are illegal.

Ator Ali doesn't know that a group is secretly observing his income pattern and they are keeping track of it. The group has set a penalty amount against his monthly income. When the right time comes, they will send him a legal notice and demand the penalty amount from him. After a few months, their analyst figured that Ator Ali's income increases by $d$ after every month. So there is no need to store the exact income of Ator Ali after each month. Instead, his income after any month $n$ can be calculated from his first month’s income and the value of $d$. As there are many dishonest persons in society, the group is busy keeping track of the income of a lot of people. So they need your help to calculate the income of Ator after the $nth$ month.

## Input

The first line of the input will contain an integer $T$ $(1 \leq T \leq 1000)$ that denotes the number of test cases. Then for each test case there will be an integer $Q$ $(1 \leq Q \leq 500)$ which denotes the number of queries we want to make. Then for each query, there will be three positive integers $x$, $d$, $n$ ( $0 ≤ x, d, n ≤ 10^9$) that denotes Ator Ali's income of the first month from when the group started tracking his income, the increased amount of income between any two consecutive months and the month on which they want to calculate Ator Ali’s income respectively.

## Output

For each input, output the amount of money earned by Ator Ali on the n-th month.

## Sample

InputOutput
1
1
10 5 6

35


### Statistics

94% Solution Ratio

Siddik_53rdEarliest, 2w ago

TurinhstuFastest, 0.1s

plasticneuronsLightest, 10 MB

anonyo.akandShortest, 168B