Alice and Bob are walking on an infinite straight street. Initially, both are at the position $X=0$ and they start walking in the direction of increasing $X$. After $N$ seconds, they stop. Let's denote Alice's speed and Bob's speed during the $i$-th of these seconds by $A_i$ and $B_i$ respectively.
Sometimes, Alice and Bob walk together, i.e. with the same speed side by side. Let's define the weird distance as the total distance they walk this way. Find this weird distance.

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first line of each test case contains a single integer $N$.
- The second line contains $N$ space-separated integers $A_1, A_2, \ldots, A_N$.
- The third line contains $N$ space-separated integers $B_1, B_2, \ldots, B_N$.

-----Output-----
For each test case, print a single line containing one integer ― the total weird distance. It can be proved that this distance is an integer.

-----Constraints-----
- $1 \le T \le 20$
- $1 \le N \le 10^5$
- $1 \le A_i \le 10^5$ for each valid $i$
- $1 \le B_i \le 10^5$ for each valid $i$
- the sum of $N$ over all test cases does not exceed $10^6$

-----Subtasks-----
Subtask #1 (30 points): $1 \le N \le 1,000$
Subtask #2 (70 points): original constraints

-----Example Input-----
3
4
1 3 3 4
1 2 4 4
2
2 3
3 2
2
3 3
3 3

-----Example Output-----
5
0
6

-----Explanation-----
Example case 1:
- Alice and Bob walk side by side during the first second, from $X=0$ to $X=1$.
- Then, Alice starts walking faster than Bob, so they do not walk side by side during second $2$. At the end of second $2$, Alice is at $X=4$, while Bob is at $X=3$.
- During the next second, they again do not walk side by side, but Bob walks faster, so they both end up at $X=7$.
- During the last second, they both walk side by side and the distance they walk is $4$.
- Alice and Bob walk side by side during the $1$-st and $4$-th second and the total weird distance they travel is $1+4=5$.
Example case 2:
- First, Alice walks with speed $2$ and Bob walks with speed $3$, so they do not walk side by side. Alice ends up at $X=2$, while Bob ends up at $X=3$ at the end of the $1$-st second.
- Then, Alice walks with speed $3$ and Bob walks with speed $2$, so they do not walk side by side either.
- Although Alice and Bob both end up at $X=5$ at the end of the $2$-nd second, the weird distance is $0$.
Example case 3: We can see that Alice and Bob always walk together, so the weird distance is $3+3=6$.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'for _ in range(int(input())):\n n = int(input())\n\n arr1 = list(map(int,input().split()))\n arr2 = list(map(int,input().split()))\n res=0\n presum1=0\n presum2=0\n for i in range(n):\n  if arr1[i]== arr2[i] and presum1==presum2 :\n   \n   res+=arr1[i]\n  presum1+=arr1[i]\n  presum2 +=arr2[i]\n  \n print(res)\n\n   \n\n\n\n \n\n\n\n\n \n\n\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13203