# Input Format and Sample Input

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:

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 3 relatives. During Christmas, the first relative gives him 500 pesos as a gift. The second relative gives exactly the same amount as the first relative. The third relative gives exactly the same amount as the second relative. How much is the total money that Emilio receives from his relatives?

The second question will be:

Emilio has 2 relatives. During Christmas, the first relative gives him 200 pesos as a gift. The second relative gives exactly the same amount as the first relative.The third relative gives exactly the same amount as the second relative. The fourth relative gives exactly the same amount as the third relative. The fifth relative gives exactly the same amount as the fourth relative. 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.