P15612 [CodeChef] MAYOR PARTY
普及-
题目描述

The mayor of your city has decided to throw a party to gather the favour of his people in different regions of the city.

There are 3 distinct regions in the city namely A, B, C comprising of P_{A}, P_{B} and P_{C} number of people respectively.

However, the mayor knows that people of the region B are in conflict with people of regions A and C. So, there will be a conflict if people from region B are present at the party along with people from region A or C.

The mayor wants to invite as many people as possible and also avoid any conflicts. Help him invite maximum number of people to the party.

------ Input Format ------

  • The first line contains a single integer T - the number of test cases. Then the test cases follow.
  • The first line of each test case contains three integers P_{A}, P_{B} and P_{C} - number of people living in regions A, B and C respectively.

------ Output Format ------

For each test case, output the maximum number of people that can be invited to the party.

------ Constraints ------

$1 ≤ T ≤ 1000$
$1 ≤ P_{A}, P_{B}, P_{C} ≤ 1000$

----- Sample Input 1 ------
3
2 3 4
1 5 2
8 8 8

----- Sample Output 1 ------
6
5
16

----- explanation 1 ------
Test case-1: Mayor can invite all the people from region $A$ and $C$. So the maximum number of people invited is $6$.

Test case-2: Mayor can invite all the people from region $B$. So the maximum number of people invited is $5$.

输入格式

见题面

输出格式

见题面

样例输入
3 2 3 4 1 5 2 8 8 8
样例输出
6 5 16