The PDF version of this problem can be downloaded here.
Long long time ago, when Tomato the Great was a young man, he worked in a pizza
store. By then, he has fallen in love with milk tea. One day, he found a special store
selling a specially
avored milk tea - pizza milk tea! Since he loved both pizza and milk
tea very much, he sworn to drink 1 liter of pizza milk tea everyday, no more, no less.
At the night of day 0, Tomato the Great has no money nor pizza milk tea. Every
morning he receives his daily salary x dollars. At noon, he would drink 1 liter of pizza
milk tea. If he has no pizza milk tea on hand to drink, he will buy it as many liters
as possible. The cost per 1 liter of pizza milk tea is y dollars. Since Tomato the Great
does not like fractions, he will only buy integral liters of pizza milk tea.
At the night of day z, he would like to check how much money he has. Can you
calculate the correct amount of money for him?
The first line of the input le contains an integer T (1 ≤ T ≤ 50000) indicating the number of test cases.
Each test case is on one line, containing three integers, x, y, and z (1 ≤ y ≤ x ≤ 109,
1 ≤ z ≤ 109).
For each test case please output an integer in one line, denoting the correct amount of
money.
3 5 2 1 5 2 2 5 2 3
1 6 1
Migrated from old NTUJ.
dreamoon
No. | Testdata Range | Score |
---|