Ramen Formula
Time limit1sMemory limit1024 MB
Given N cases of coefficients A, B and pack count X, print W = A(X-1)+B for each case.
- Level
Easy1 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
"Curly curly, delicious ramen. Ramen is here, so life is worth living. I could eat ten in a day. Slurp slurp, crunch crunch, delicious ramen."
Yechan loves ramen very much. As the top ramen fan at Sunlin, he often gulps down several packs in one meal.
He has long wanted to know how much water makes the best ramen. After long experiments, he finally came up with the following ramen formula.
Here, is the amount of water needed, is the ramen coefficient, is the base amount of water, and is the number of ramen packs to cook.
Input
The first line contains , the number of times Yechan cooks ramen.
From line 2 to line , line contains , , and separated by spaces, where is the ramen coefficient, is the base amount of water, and is the number of ramen packs cooked the -th time.
All numbers in the input are integers.
Output
Print lines. On line (), print , the amount of water needed by the ramen formula for the -th cooking.