The n-th day of training
On the planet of superheroes, water polo players take part in a training camp for a competition that lasts n days. On the first day of the camp a water polo player swims a metres, and on every following day d metres more than on the previous day. Write a program that finds, for every water polo player in the club, how many metres they swim on the last day of the camp.
Input: The first line of the standard input contains the number of days of the camp n (n ≤ 105). Every following line of the standard
input contains the data for one water polo player (at most 105 of them). Two numbers separated by a
space are entered: the number of metres the player swims on the first day of the camp a (a ≤ 3000), and the number of metres they
swim more every day than on the previous day d (d ≤ 1000).
Output:
On the standard output, for every water polo player, print how many metres they swim on the last day of the camp.
Example:
Input:
10
500 100
400 20
Output:
1400
580
Read the explanation of the task on the page: Replacing iteration with a formula (SR)
