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 dd 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 nn can be calculated from his first month’s income and the value of dd. 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 nthnth month.

Input

The first line of the input will contain an integer TT (1T1000)(1 \leq T \leq 1000) that denotes the number of test cases. Then for each test case there will be an integer QQ (1Q500)(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 xx, dd, nn ( 0x,d,n1090 ≤ 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

Submit

Login to submit.

Statistics

89% Solution Ratio
Siddik_53rdEarliest, Nov '21
Kuddus.6068Fastest, 0.1s
nusuBotLightest, 4.9 MB
Nusab19Shortest, 98B
Toph uses cookies. By continuing you agree to our Cookie Policy.