#P1898D. Absolute Beauty

Absolute Beauty

No submission language available for this problem.

Description

Kirill has two integer arrays a1,a2,,ana_1,a_2,\ldots,a_n and b1,b2,,bnb_1,b_2,\ldots,b_n of length nn. He defines the absolute beauty of the array bb as i=1naibi.\sum_{i=1}^{n} |a_i - b_i|. Here, x|x| denotes the absolute value of xx.

Kirill can perform the following operation at most once:

  • select two indices ii and jj (1i<jn1 \leq i < j \leq n) and swap the values of bib_i and bjb_j.

Help him find the maximum possible absolute beauty of the array bb after performing at most one swap.

Each test contains multiple test cases. The first line contains the number of test cases tt (1t100001 \leq t \leq 10\,000). The description of test cases follows.

The first line of each test case contains a single integer nn (2n21052\leq n\leq 2\cdot 10^5) — the length of the arrays aa and bb.

The second line of each test case contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n (1ai1091\leq a_i\leq 10^9) — the array aa.

The third line of each test case contains nn integers b1,b2,,bnb_1, b_2, \ldots, b_n (1bi1091\leq b_i\leq 10^9) — the array bb.

It is guaranteed that the sum of nn over all test cases does not exceed 21052\cdot 10^5.

For each test case, output one integer — the maximum possible absolute beauty of the array bb after no more than one swap.

Input

Each test contains multiple test cases. The first line contains the number of test cases tt (1t100001 \leq t \leq 10\,000). The description of test cases follows.

The first line of each test case contains a single integer nn (2n21052\leq n\leq 2\cdot 10^5) — the length of the arrays aa and bb.

The second line of each test case contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n (1ai1091\leq a_i\leq 10^9) — the array aa.

The third line of each test case contains nn integers b1,b2,,bnb_1, b_2, \ldots, b_n (1bi1091\leq b_i\leq 10^9) — the array bb.

It is guaranteed that the sum of nn over all test cases does not exceed 21052\cdot 10^5.

Output

For each test case, output one integer — the maximum possible absolute beauty of the array bb after no more than one swap.

Sample Input 1

6
3
1 3 5
3 3 3
2
1 2
1 2
2
1 2
2 1
4
1 2 3 4
5 6 7 8
10
1 8 2 5 3 5 3 1 1 3
2 9 2 4 8 2 3 5 3 1
3
47326 6958 358653
3587 35863 59474

Sample Output 1

4
2
2
16
31
419045

Note

In the first test case, each of the possible swaps does not change the array bb.

In the second test case, the absolute beauty of the array bb without performing the swap is 11+22=0|1-1| + |2-2| = 0. After swapping the first and the second element in the array bb, the absolute beauty becomes 12+21=2|1-2| + |2-1| = 2. These are all the possible outcomes, hence the answer is 22.

In the third test case, it is optimal for Kirill to not perform the swap. Similarly to the previous test case, the answer is 22.

In the fourth test case, no matter what Kirill does, the absolute beauty of bb remains equal to 1616.