You have n gifts and you want to give all of them to children. Of course, you don't want to offend anyone, so all gifts should be equal between each other. The i-th gift consists of a_i candies and b_i oranges.

During one move, you can choose some gift 1 ≤ i ≤ n and do one of the following operations:

  * eat exactly one candy from this gift (decrease a_i by one); 
  * eat exactly one orange from this gift (decrease b_i by one); 
  * eat exactly one candy and exactly one orange from this gift (decrease both a_i and b_i by one). 



Of course, you can not eat a candy or orange if it's not present in the gift (so neither a_i nor b_i can become less than zero).

As said above, all gifts should be equal. This means that after some sequence of moves the following two conditions should be satisfied: a_1 = a_2 = ... = a_n and b_1 = b_2 = ... = b_n (and a_i equals b_i is not necessary).

Your task is to find the minimum number of moves required to equalize all the given gifts.

You have to answer t independent test cases.

Input

The first line of the input contains one integer t (1 ≤ t ≤ 1000) — the number of test cases. Then t test cases follow.

The first line of the test case contains one integer n (1 ≤ n ≤ 50) — the number of gifts. The second line of the test case contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^9), where a_i is the number of candies in the i-th gift. The third line of the test case contains n integers b_1, b_2, ..., b_n (1 ≤ b_i ≤ 10^9), where b_i is the number of oranges in the i-th gift.

Output

For each test case, print one integer: the minimum number of moves required to equalize all the given gifts.

Example

Input


5
3
3 5 6
3 2 3
5
1 2 3 4 5
5 4 3 2 1
3
1 1 1
2 2 2
6
1 1000000000 1000000000 1000000000 1000000000 1000000000
1 1 1 1 1 1
3
10 12 8
7 5 4


Output


6
16
0
4999999995
7

Note

In the first test case of the example, we can perform the following sequence of moves:

  * choose the first gift and eat one orange from it, so a = [3, 5, 6] and b = [2, 2, 3]; 
  * choose the second gift and eat one candy from it, so a = [3, 4, 6] and b = [2, 2, 3]; 
  * choose the second gift and eat one candy from it, so a = [3, 3, 6] and b = [2, 2, 3]; 
  * choose the third gift and eat one candy and one orange from it, so a = [3, 3, 5] and b = [2, 2, 2]; 
  * choose the third gift and eat one candy from it, so a = [3, 3, 4] and b = [2, 2, 2]; 
  * choose the third gift and eat one candy from it, so a = [3, 3, 3] and b = [2, 2, 2]. 
from __future__ import division, print_function


def main():
    # Template 1.0
    import sys, re, math
    from collections import deque, defaultdict, Counter, OrderedDict
    from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, floor, log
    from heapq import heappush, heappop, heapify, nlargest, nsmallest
    def STR():
        return list(input())

    def INT():
        return int(input())

    def MAP():
        return map(int, input().split())

    def LIST():
        return list(map(int, input().split()))

    def list2d(a, b, c):
        return [[c] * b for i in range(a)]

    def sortListWithIndex(listOfTuples, idx):
        return (sorted(listOfTuples, key=lambda x: x[idx]))

    def sortDictWithVal(passedDic):
        temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
        toret = {}
        for tup in temp:
            toret[tup[0]] = tup[1]
        return toret

    def sortDictWithKey(passedDic):
        return dict(OrderedDict(sorted(passedDic.items())))

    INF = float('inf')
    mod = 10 ** 9 + 7

    t = INT()

    while(t!=0):
        n = INT()

        a = LIST()
        b = LIST()

        z1 = min(a)
        z2 = min(b)

        ans = 0

        for i in range(n):
            temp1, temp2 = 0, 0
            if(a[i]!=z1):
                temp1 = a[i]-z1
            if(b[i]!=z2):
                temp2 = b[i]-z2

            ans+=max(temp1, temp2)
        print(ans)

        t-=1


######## Python 2 and 3 footer by Pajenegod and c1729

# Note because cf runs old PyPy3 version which doesn't have the sped up
# unicode strings, PyPy3 strings will many times be slower than pypy2.
# There is a way to get around this by using binary strings in PyPy3
# but its syntax is different which makes it kind of a mess to use.

# So on cf, use PyPy2 for best string performance.

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip

    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192


class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO, self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill();
            self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s: self.buffer.write(s.encode('ascii'))
            self.read = lambda: self.buffer.read().decode('ascii')
            self.readline = lambda: self.buffer.readline().decode('ascii')


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

# Cout implemented in Python
import sys


class ostream:
    def __lshift__(self, a):
        sys.stdout.write(str(a))
        return self


cout = ostream()
endl = '\n'


# Read all remaining integers in stdin, type is given by optional argument, this is fast
def readnumbers(zero=0):
    conv = ord if py2 else lambda x: x
    A = [];
    numb = zero;
    sign = 1;
    i = 0;
    s = sys.stdin.buffer.read()
    try:
        while True:
            if s[i] >= b'0'[0]:
                numb = 10 * numb + conv(s[i]) - 48
            elif s[i] == b'-'[0]:
                sign = -1
            elif s[i] != b'\r'[0]:
                A.append(sign * numb)
                numb = zero;
                sign = 1
            i += 1
    except:
        pass
    if s and s[-1] >= b'0'[0]:
        A.append(sign * numb)
    return A


if __name__ == "__main__":
    main()