Rope Pulling, also known as Tug of War, is a classic game. After acquiring a very very very large tie under suspicious circumstances, Zhang3 is using it to organize such a game between mathies and engineers.
There are
To make the game more interesting, Zhang3 wants to choose the teams to have same total strengths, while maximizing the total meme values of all participants.
Output the maximum meme value possible. Note that empty teams are also allowed.
Input Specification
The first line of the input gives the number of test cases,
For each test case, the first line contains two integers
Then
Output Specification
For each test case, print a line with an integer, representing the maximum total meme value of two teams with the same total strength values.
Sample Input
2
3 4
4 7
3 8
2 2
1 4
5 8
1 3
4 4
1 2
1000 -10000
200 3000
800 5000
Sample Output
30
0
Problem Resource: 2020 Multi-University Training Contest 4, Hangzhou Xuejun Contest, Problem C
Comments