Contents

• # For Solution

Vishesh has gone to watch the new Spider-Man movie, but he is having troubles choosing which Popcorn-and-Coke combo to buy.

There are three combos AABB, and CC available at the counter. You are given the time (in minute) for which each Popcorn bucket and Coke cup lasts. Given that Vishesh’s satisfaction from a combo is defined as the total lasting time (in minute) of the Popcorn bucket and the Coke cup, find the maximum satisfaction he can get by buying a single combo.

### Input Format Vishesh and his Popcorn Combo solution codechef

• The first line of each input contains TT – the number of test cases. The test cases then follow.
• The first line of each test case contains two space-separated integers A1A1 and A2A2, meaning that for combo AA, the Popcorn bucket lasts A1A1 minutes and the Coke cup lasts A2A2 minutes.
• The second line of each test case contains two space-separated integers B1B1 and B2B2, meaning that for combo BB, the Popcorn bucket lasts B1B1 minutes and the Coke cup lasts B2B2 minutes.
• The third line of each test case contains two space-separated integers C1C1 and C2C2, meaning that for combo CC, the Popcorn bucket lasts C1C1 minutes and the Coke cup lasts C2C2 minutes.

### Output Format

For each test case, output on a single line the maximum satisfaction Vishesh can get.

### Constraints Vishesh and his Popcorn Combo solution codechef

• 1T10001≤T≤1000
• 1A1,A2,B1,B2,C1,C21091≤A1,A2,B1,B2,C1,C2≤109

### Sample Input 1

3
3 6
5 10
8 7
99 1
55 55
33 51
54 146
5436 627
1527 5421


### Vishesh and his Popcorn Combo solution codechef Sample Output 1

15
110
6948


### Explanation Vishesh and his Popcorn Combo solution codechef

• Test case 11:
• For combo AA, the Popcorn bucket lasts 33 minutes, and the Coke cup lasts 66 minutes, so Vishesh gets a satisfaction of 3+6=93+6=9 if he buys this combo.
• For combo BB, the Popcorn bucket lasts 55 minutes, and the Coke cup lasts 1010 minutes, so Vishesh gets a satisfaction of 5+10=155+10=15 if he buys this combo.
• For combo CC, the Popcorn bucket lasts 88 minutes, and the Coke cup lasts 77 minutes, so Vishesh gets a satisfaction of 8+7=158+7=15 if he buys this combo.

Therefore Vishesh’s maximum satisfaction is 1515.