*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 $latex T$, the number of test cases.

The next $latex T$ lines will contain two space-separated integers, representing the values $latex N$ and $latex P$, 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 $latex T$, which is the **number of test cases**. This means that your program will need to answer the question $latex T$ times.

Of course, if we need to solve the problem $latex T$ times, we need to have $latex T$ pairs of $latex N$ and $latex P$. As expected, the second part of the input format tells us what $latex N$ and $latex P$ 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 $latex T = 2$. For the first case, $latex N = 3$ and $latex P = 500$. For the second case, $latex N = 5$ and $latex P = 2000$. 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 $latex N$ and $latex P$. 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.