Monocarp had a sequence a consisting of n + m integers a_1, a_2, ..., a_{n + m}. He painted the elements into two colors, red and blue; n elements were painted red, all other m elements were painted blue.

After painting the elements, he has written two sequences r_1, r_2, ..., r_n and b_1, b_2, ..., b_m. The sequence r consisted of all red elements of a in the order they appeared in a; similarly, the sequence b consisted of all blue elements of a in the order they appeared in a as well.

Unfortunately, the original sequence was lost, and Monocarp only has the sequences r and b. He wants to restore the original sequence. In case there are multiple ways to restore it, he wants to choose a way to restore that maximizes the value of 

$$$f(a) = max(0, a_1, (a_1 + a_2), (a_1 + a_2 + a_3), ..., (a_1 + a_2 + a_3 + ... + a_{n + m}))$$$

Help Monocarp to calculate the maximum possible value of f(a).

Input

The first line contains one integer t (1 ≤ t ≤ 1000) — the number of test cases. Then the test cases follow. Each test case consists of four lines.

The first line of each test case contains one integer n (1 ≤ n ≤ 100).

The second line contains n integers r_1, r_2, ..., r_n (-100 ≤ r_i ≤ 100).

The third line contains one integer m (1 ≤ m ≤ 100).

The fourth line contains m integers b_1, b_2, ..., b_m (-100 ≤ b_i ≤ 100).

Output

For each test case, print one integer — the maximum possible value of f(a).

Example

Input


4
4
6 -5 7 -3
3
2 3 -4
2
1 1
4
10 -3 2 2
5
-1 -2 -3 -4 -5
5
-1 -2 -3 -4 -5
1
0
1
0


Output


13
13
0
0

Note

In the explanations for the sample test cases, red elements are marked as bold.

In the first test case, one of the possible sequences a is [6, 2, -5, 3, 7, -3, -4].

In the second test case, one of the possible sequences a is [10, 1, -3, 1, 2, 2].

In the third test case, one of the possible sequences a is [-1, -1, -2, -3, -2, -4, -5, -3, -4, -5].

In the fourth test case, one of the possible sequences a is [0, 0].
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from sys import stdin,stdout
from io import BytesIO, IOBase
from collections import deque
#sys.setrecursionlimit(10**5)
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

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


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        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")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion
"""
def main():
    t = int(input())
    for _ in range(t):
        p = []
        n = int(input())
        arr = list(map(int, input().split()))
        for i in range(1, n + 1):
            j = i
            i += arr[i - 1]
            while (i <= n):
                i += arr[i - 1]
            else:
                p.append(i - j)
        print(max(p))
"""
"""
def main():
    t = int(input())
    for _ in range(t):
        n = int(input())
        p=[0]*(n)
        arr = list(map(int,input().split()))
        for i in range(n-1,-1,-1):
            p[i]=arr[i]
            j = i + arr[i]
            if j<n:
                p[i]+=p[j]
            #i-=1
        print(max(p))

if __name__ == "__main__":
    main()
"""
"""
def main():
    s = input()
    t = input()
    def issubstring(a, b):
        cnt = 0
        for i in b:
            if i in a:
                a = list(a)
                a.remove(i)
                p=""
                for i in a:
                    p+=i
                a = p
                cnt += 1
        if cnt == len(b):
            return True
        else:
            return False

    #if issubstring(s, t) == True and t in s:
    #    print("automaton")
    if sorted(s)==sorted(t):
        print("array")
    else:
        j=0
        pp=""
        for i in range(len(s)):
            if j==len(t):
                break
            else:
                if s[i]==t[j]:
                    pp+=(s[i])
                    j+=1
        if pp==t:
            print("automaton")
        elif issubstring(s, t) == True and len(s) != len(t) and t not in s:
            print("both")
        else:
            print("need tree")
   # print(issubstring("abcdef","aaaaaaa"))
"""
"""
def main():
    t = int(input())
    l=[]
    ans=0
    #cnt=0
    for _ in range(t):
        s = int(input())
        l.append(s)
    l.reverse()
    l.append(0)
    l.reverse()
    for i in range(1,t+1):
        cnt=0
        x=l[i]
        while(x!=-1):
            x=l[x]
            cnt+=1
        ans=max(cnt,ans)
    print(ans+1)
"""
"""
def main():
    t = int(input())
    for _ in range(t):
        c1,c2,c3=map(int,input().split())
        a1,a2,a3,a4,a5=map(int,input().split())
        if a1>c1 or a2>c2 or a3>c3:
            print("NO")
        else:
            c1 = c1 - a1
            c2 = c2 - a2
            c3 = c3 - a3
            a4-=min(a4,c1)
            a5-=min(a5,c2)
            if a4+a5<=c3:
                print("YES")
            else:
                print("NO")
"""
"""
def main():
    n = int(input())
    a = list(map(int, input().split()))
    g = int(input())
    q = list(map(int, input().split()))
    sum1=0
    l=[0]*10000000
    d=[0]*10000000
    ind =0
    
    for i in range(n):
        d.append(c + 1)
        c = c + a[i]
        d.append(c)
    
    for i in a:
        sum1+=i
        d.append(sum1)
    for i in range(1,sum1+1):
        if i>d[ind]:
            ind+=1
        l[i]=(ind+1)
    for i in q:
        print(l[i])
"""
def main():
    t = int(input())
    for _ in range(t):
        n = int(input())
        a = list(map(int, input().split()))
        m = int(input())
        b = list(map(int, input().split()))
        dp = [[-10 ** 9 for j in range(m + 1)] for i in range(n + 1)]
        dp[0][0] = 0
        ans = 0
        for i in range(n + 1):
            for j in range(m + 1):
                if i < n:
                    dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + a[i])
                if j < m:
                    dp[i][j + 1] = max(dp[i][j + 1], dp[i][j] + b[j])
                ans = max(ans, dp[i][j])
        print(ans)

if __name__ == '__main__':
    main()
