*We are discussing the Aguinaldo sample problem. This is Part 2 of a series of posts which started here.*

The first line of input will contain an integer , the number of test cases.

The next lines will contain two space-separated integers, representing the values and , in that order.

After the problem statement is the input format. This tells you how the data is arranged. Here, we see a new variable , which is the **number of test cases**. This means that your program will need to answer the question times.

Of course, if we need to solve the problem times, we need to have pairs of and . As expected, the second part of the input format tells us what and are for **each test case**.

Let’s look at the **sample input** for a more concrete example:

1 2 3 |
2 3 500 5 2000 |

We see that . For the first case, and . For the second case, and . This input format is equivalent to your math teacher giving you an exam with two questions.

The first question will be:

Emilio has

3relatives. During Christmas, the first relative gives him500pesos as a gift. Thesecondrelative gives exactly the same amount as thefirstrelative. Thethirdrelative gives exactly the same amount as thesecondrelative. How much is the total money that Emilio receives from his relatives?

The second question will be:

Emilio has

2relatives. During Christmas, the first relative gives him 200pesos as a gift. Thesecondrelative gives exactly the same amount as thefirstrelative.Thethirdrelative gives exactly the same amount as thesecondrelative. Thefourthrelative gives exactly the same amount as thethirdrelative. Thefifthrelative gives exactly the same amount as thefourthrelative. How much is the total money that Emilio receives from his relatives?

Imagine having a teacher who gives you ten problems of this form! At first it will be fine, but then it gets boring since it’s essentially the same problem again and again. Usually, when you figure out how to solve it, then repeating it nine times becomes tedious.

But don’t worry! The good news it that **you can write a program** that answers this question **correctly** for any value of and . In a way, writing a program that answers the question is **proof** that you know how to answer any question of that form. No matter what the numbers are.