#C4874. Total Weight of Balls
Total Weight of Balls
Total Weight of Balls
You are given several test cases. For each test case, you are given two integers N and M representing the number of red balls and blue balls respectively. The weight of a red ball is 1 unit while the weight of a blue ball is 2 units.
Your task is to calculate the total weight of the balls for each test case using the formula:
$$\text{Total Weight} = N \times 1 + M \times 2$$
Read the input from stdin and write the output to stdout, printing each result on a new line.
inputFormat
The input begins with an integer T on the first line, representing the number of test cases. Each of the following T lines contains two space-separated integers N and M, where N is the number of red balls and M is the number of blue balls.
outputFormat
For each test case, output a single line containing the total weight computed as N + 2*M
.
1
1 2
5
</p>