Chef has an array
of length . He defines the alternating sum of the array as:
Chef is allowed to perform the following operation on the array at most once:
- Choose two indices and and swap the elements and .
Find the maximum alternating sum Chef can achieve by performing the operation at most once.
Note: denotes the absolute value of . For example, and .
Input Format
- The first line will contain - the number of test cases. Then the test cases follow.
- First line of each test case contains a single integer - size of the array .
- Second line of each test case contains space separated integers - denoting the elements of array .
Output Format
For each testcase, output in a single line, the maximum alternating sum Chef can obtain by performing the operation at most once.
Constraints
- Sum of over all test cases does not exceed .
Sample Input 1
2
2
10 -10
7
-3 -2 -1 0 1 2 3
Sample Output 1
0
6
Explanation
Test Case : One optimal way is to perform no operations. Thus the alternating sum is .
Test Case : One optimal way is to choose and . After swapping, the array is . The alternating sum in this case is
ConversionConversion EmoticonEmoticon