Tuenti Challenge 9

Challenge 1 - Onion wars

You are celebrating your 20 months anniversary at Tuenti today! As part of the celebration, you have decided to bring some good tortilla española for your coworkers, but you realize that each person only eats tortillas with or without onion.

Given that each person eats half tortilla, what is the minimum number of tortillas you need to ensure that everyone gets their share? Keep in mind that you can only bring whole tortillas, with or without onion.

Note: although it would be correct to bring only tortilla with onion since a tortilla without onion is horrible, we don't want to start an internal war over this, so we want you to bring enough food for both groups.

Input

The first line has an integer C, which is the number of cases for the problem. Then C lines follow and each one has two integers N and M, which are the number of people that want tortillas with and without onion, respectively.

Output

For each case, there should be a line starting with "Case #x: " followed by the minimum number of tortilla you must bring.

Limits

  • 1 ≤ C ≤ 100
  • 0 ≤ N, M ≤ 100000
  • 1 ≤ N + M

Sample Input

3
2 2
3 2
0 1

Sample Output

Case #1: 2
Case #2: 3
Case #3: 1

In the first case, we need one tortilla per group.
In the second case, we need two tortillas (since it is not possible to only bring one and a half) with onions and one without onions.
In the third case, we only need half of a tortilla with onion, but we bring one since they are indivisible.

Test your code

You can test your program against both the input provided in the test phase and the input provided in the submit phase. A nice output will tell you if your program got the right solution or not. You can try as many times as you want to. Be careful with extra whitespaces, the output should be exactly as described.

Test your program against the input provided in the test phase

Download test input

Program output:

Test your program against the input provided in the submit phase

Download input

Program output:

During the submit phase, in some problems, we might give your program harder inputs. As with the test token, a nice output will tell you if your program got the right solution or not. You can try as many times as you need.

In the actual contest you first need to solve the test phase before submitting the code, you must provide the source code used to solve the challenge and you can only submit once (once your solution is submitted you won't be able to amend it to fix issues or make it faster).

If you have any doubts, please check the info section.