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].

import java.awt.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
import java.util.List;

/**
 * Codeforces
 * 
 * 
 */
public class Codeforcess {

    public static boolean has1inbetween(String s, int i, int j) {
        boolean ans = true;
        char ch[] = s.toCharArray();

        for (int b = i + 1; b < j && b < s.length() && i < ch.length && j < ch.length; b++) {
            if (ch[i] == '1') {
                ans = false;
            }
        }
        return ans;
    }

    public static int segregate(int arr[], int size) {
        int j = 0, i;
        for (i = 0; i < size; i++) {
            if (arr[i] <= 0) {
                int temp;
                temp = arr[i];
                arr[i] = arr[j];
                arr[j] = temp;
                // increment count of non-positive
                // integers
                j++;
            }
        }

        return j;
    }

    public static long lowComMultiple(long a, long b) {
        long min = a * b;
        long start = Math.min(a, b);
        long ans = -1;
        for (int i = (int) start; i <= min; i++) {
            if (i % a == 0 && i % b == 0) {
                ans = i;
                break;
            }
        }
        return ans;
    }

    public static int solution(int[] A) {
        int n = A.length;

        // To mark the occurrence of elements
        boolean[] present = new boolean[n + 1];

        // Mark the occurrences
        for (int i = 0; i < n; i++) {

            if (A[i] > 0 && A[i] <= n)
                present[A[i]] = true;
        }

        // Find the first element which didn't
        // appear in the original array
        for (int i = 1; i <= n; i++)
            if (!present[i])
                return i;

        return n + 1;
    }

    public static ArrayList<Long> digit(long num) {
        long dig = 0;
        // long length = 0;
        ArrayList<Long> digi = new ArrayList<>();
        while (num > 0) {
            dig = num % 10;
            digi.add(dig);
            num = num / 10;

        }
        // return dig; //System.out.printf("%d", +revnum);

        return digi;
    }

    static int[] shuffle(int a[], int n) {
        for (int i = 0; i < n; i++) {

            // getting the random index
            int t = (int) Math.random() * a.length;

            // and swapping values a random index
            // with the current index
            int x = a[t];
            a[t] = a[i];
            a[i] = x;
        }
        return a;
    }

    public static long addDigits(long num) {
        long digit = 0;
        // long sum = 0;
        long dig = -1;

        while (num != 0) {
            digit = num % 10;
            dig = digit;
            num = num / 10;
            break;
        }
        return dig;
    }

    public static int addDigit(long num) {
        long digit = 0;
        // long sum = 0;
        int count = 0;

        while (num != 0) {
            digit = num % 10;
            count++;
            num = num / 10;

        }
        return count;
    }

    public static class Pair<A, B> {
        private A first;
        private B second;

        public Pair(A first, B second) {
            this.first = first;
            this.second = second;
        }

        public A getFirst() {
            return first;
        }

        public B getSecond() {
            return second;
        }

        public void setFirst(A first) {
            this.first = first;
        }

        public void setSecond(B second) {
            this.second = second;
        }
    }

    static void findPair(int values[], int n, Pair<Integer, Integer> ans) {
        // Pair<Integer, Integer> ans = new Pair<Integer,Integer>(0, 0);
        int size = values.length;
        int i = 0, j = 1;
        int minLen = Integer.MAX_VALUE;
        int in = -1;
        int jn = -1;
        while (i < size && j < size) {

            if (i != j && values[j] - values[i] == n) {

                if (j - i < minLen) {
                    in = i;
                    jn = j;
                }
                break;
                // System.out.print("Pair Found: " + "( " + values[i] + ", " + values[j] + "
                // )");
                // return "1";
            } else if (values[j] - values[i] < n)
                j++;
            else
                i++;
        }

        if (in == -1 && jn == -1) {
            ans.setFirst(-1);
            ans.setSecond(-1);
        } else {
            ans.setFirst(in + 1);
            ans.setSecond(jn + 1);
        }

        // return ans;
    }

    public static String findMinDays(int[] values, int[] profit) {

        StringBuilder str = new StringBuilder();
        ArrayList<Pair<Integer, Integer>> ans = new ArrayList<>();
        Pair<Integer, Integer> p = new Pair<Integer, Integer>(0, 0);
        for (int i = 0; i < profit.length; i++) {
            findPair(values, profit[i], p);
            ans.add(p);
        }

        for (int i = 0; i < ans.size(); i++) {
            if (ans.get(i).getFirst() != -1 || ans.get(i).getSecond() != -1) {
                str.append(ans.get(i).getFirst());
                str.append(" ");
                str.append(ans.get(i).getSecond() + ",");
            } else {
                str.append(-1 + ",");
            }
        }

        String s;
        str.setCharAt(str.length() - 1, ' ');
        s = str.toString();
        return s;

    }

    public static long fact(long n) {
        BigInteger res = new BigInteger("1");
        for (long i = 2; i <= n; i++)
            res = res.multiply(BigInteger.valueOf(i));
        return res.longValue();
    }

    public static long nCr(long n, long r) {
        long den = (fact(r) * fact(n - r));
        long num = fact(n);
        if (den <= 0 || num < 0)
            return 1;
        else
            return num / den;

    }

    public static int[] seq(int n, int x, int y) {
        int best = Integer.MAX_VALUE;
        int[] bestArr = new int[n];
        for (int start = 1; start <= 50; start++) {
            for (int diff = 1; diff <= 50; diff++) {
                boolean X = false, Y = false;
                int[] a = ap(n, start, diff);
                for (int i = 0; i < n; i++) {
                    if (a[i] == x)
                        X = true;
                    if (a[i] == y)
                        Y = true;

                }
                if (X && Y && a[n - 1] < best) {
                    best = a[n - 1];
                    bestArr = a;
                }
            }
        }
        return bestArr;
    }

    public static int[] ap(int n, int start, int diff) {
        int arr[] = new int[n];
        arr[0] = start;
        for (int i = 1; i < n; i++) {
            arr[i] = arr[i - 1] + diff;
        }
        return arr;
    }

    public static int cntSame(String s) {
        int ans = 0;
        for (int i = 1; i < s.length(); i++) {
            if (s.charAt(i - 1) == s.charAt(i)) {
                ans++;

            }
        }
        if (ans % 2 == 0)
            ans = ans / 2;

        return ans;
    }

    public void dump() {

        // int n = sc.nextInt();
        // int m = sc.nextInt();
        // int countNRow = 0;
        // int totalNeg = 0;
        // ArrayList<Integer> rowSignAcc = new ArrayList<>();
        // int arr[][] = new int[n][m];
        // for (int i = 0; i < n; i++) {
        // countNRow = 0;
        // for (int j = 0; j < m; j++) {
        // arr[i][j] = sc.nextInt();
        // if (arr[i][j] < 0) {
        // totalNeg++;
        // countNRow++;
        // }

        // }
        // rowSignAcc.add(countNRow);
        // }
        // int sum = 0, sum1 = 0;
        // for (int i = 0; i < n; i++) {
        // for (int j = 0; j < m; j++) {
        // if (arr[i][j] < 0) {
        // arr[i][j] = -1 * arr[i][j];
        // sum += arr[i][j];
        // } else {
        // sum += arr[i][j];
        // }
        // }
        // }
        // if (totalNeg % 2 == 0) {
        // System.out.println(sum);
        // } else {
        // arr[0][0] = -1 * arr[0][0];
        // for (int i = 0; i < n; i++) {
        // for (int j = 0; j < m; j++) {
        // sum1 += arr[i][j];
        // }
        // }
        // System.out.println(sum1);
        // }

        // }

    }

    public static boolean isPrime(long number) {
        if (number == 1)
            return false;
        else {
            for (long i = number - 1; i > 1; i--) {
                if (number % i == 0) {
                    return false;
                }
            }
            return true;
        }
    }

    public static boolean isRotations(String s1, String s2) {
        String temp = s1 + s1;
        // for (int i = 0; i < temp.length(); i++) {
        // for (int j = i + 1; j <= temp.length(); j++) {
        // String ans = temp.substring(i, j);
        // if (ans.equals(s2))
        // return true;

        // }
        // }
        return (s1.length() == s2.length()) && ((s1 + s1).indexOf(s2) != -1);
    }

    public static long Digits(BigInteger num) {
        BigInteger digit;

        long sum = 0;

        // StringBuilder rev = new StringBuilder();
        while (num.compareTo(BigInteger.valueOf(0)) != 0) {
            digit = num.remainder(BigInteger.valueOf(10));
            sum++;

            num = num.divide(BigInteger.valueOf(10));
        }

        return sum;
    }

    public static boolean isValid(String s) {
        Stack<Character> stack = new Stack<Character>();
        for (char c : s.toCharArray()) {
            if (c == '(')
                stack.push(')');
            else if (c == '{')
                stack.push('}');
            else if (c == '[')
                stack.push(']');
            else if (stack.isEmpty() || stack.pop() != c)
                return false;
        }
        return stack.isEmpty();
    }

    public static void main(String[] args) {

        try {
            Scanner sc = new Scanner(System.in);
            int t = sc.nextInt();
            while (t-- > 0) {

                int n = sc.nextInt();
                int r[] = new int[n + 1];
                for (int i = 1; i <= n; i++) {
                    r[i] = sc.nextInt();
                }
                int m = sc.nextInt();
                int b[] = new int[m + 1];
                for (int i = 1; i <= m; i++) {
                    b[i] = sc.nextInt();
                }
                int maxR = Integer.MIN_VALUE;
                int sumR = 0;
                int sumRArr[] = new int[n + 1];
                int sumBArr[] = new int[m + 1];
                for (int i = 1; i < n + 1; i++) {
                    sumR += r[i];
                    sumRArr[i] = sumR;

                }
                int maxB = Integer.MIN_VALUE;
                int sumB = 0;
                for (int j = 1; j < m + 1; j++) {
                    sumB += b[j];
                    sumBArr[j] = sumB;
                }
                int sum = 0;
                int max = 0;
                for (int i = 0; i < n + 1; i++) {
                    for (int j = 0; j < m + 1; j++) {
                        sum = sumBArr[j] + sumRArr[i];
                        max = Math.max(sum, max);
                    }
                }

                System.out.println(max);

            }

        } catch (Exception e) {
            System.out.println(e);
        }

    }
}
