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

/**
* Date: 
* Link:
*
* @author: Prasad Chaudhari
* @linkedIn: https://www.linkedin.com/in/prasad-chaudhari-841655a6/
* @git: https://github.com/Prasad-Chaudhari
*/
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.util.Stack;

public class Main {

    public static void main(String[] args) throws Exception {
        FastIO in = new FastIO(args);
        int t = in.ni();
        while (t-- > 0) {
            int n = in.ni();
            int max = 0;
            int pre = 0;
            for (int i = 0; i < n; i++) {
                max = Math.max(max, pre += in.ni());
            }
            int ans = max;
            max = 0;
            pre = 0;
            int m = in.ni();
            for (int i = 0; i < m; i++) {
                max = Math.max(max, pre += in.ni());
            }
            System.out.println(ans + max);
        }
        in.bw.flush();
    }

    // public static void main(String[] args) throws Exception {
    // FastIO in = new FastIO(args);
    // long mod = 998244353;
    // int n = in.ni();
    // int q = in.ni();
    // int from[] = new int[n - 1];
    // int to[] = new int[n - 1];
    // int count[] = new int[n + 1];
    // for (int i = 0; i < n - 1; i++) {
    // count[from[i] = in.ni()]++;
    // count[to[i] = in.ni()]++;
    // }
    // int adja[][] = new int[n + 1][];
    // for (int i = 0; i <= n; i++)
    // adja[i] = new int[count[i]];
    // for (int i = 0; i < n - 1; i++) {
    // adja[from[i]][--count[from[i]]] = to[i];
    // adja[to[i]][--count[to[i]]] = from[i];
    // }
    // Stack<Integer> st = new Stack<>();
    // boolean b[] = new boolean[n + 1];
    // st.push(1);
    // int parent[] = new int[n + 1];
    // long[] no_of_paths_including = new long[n + 1];
    // long[] no_of_paths_ending_at = new long[n + 1];
    // long[] no_of_paths_of_all_types = new long[n + 1];
    // long[] no_of_paths_sum = new long[n + 1];
    // long[] no_of_paths_mul = new long[n + 1];
    // long[] no_of_paths_above = new long[n + 1];
    // while (!st.isEmpty()) {
    // int root = st.peek();
    // if (b[root]) {
    // no_of_paths_mul[root] = 1;
    // for (int i : adja[root]) {
    // if (i != parent[root]) {
    // no_of_paths_ending_at[root] += (no_of_paths_ending_at[i]
    // * Expo.a_pow_n_mod_m(no_of_paths_of_all_types[i], mod - 2, mod)) % mod;
    // no_of_paths_ending_at[root] %= mod;
    // no_of_paths_mul[root] *= no_of_paths_of_all_types[i];
    // no_of_paths_mul[root] %= mod;
    // }
    // }
    // no_of_paths_ending_at[root]++;
    // no_of_paths_ending_at[root] *= no_of_paths_mul[root];
    // no_of_paths_ending_at[root] %= mod;
    // no_of_paths_sum[root] = 0;
    // for (int i : adja[root]) {
    // if (i != parent[root]) {
    // long p = (no_of_paths_ending_at[i]
    // * Expo.a_pow_n_mod_m(no_of_paths_of_all_types[i], mod - 2, mod)) % mod;
    // no_of_paths_including[root] += (p * no_of_paths_sum[root]) % mod;
    // no_of_paths_including[root] %= mod;
    // no_of_paths_sum[root] += p;
    // no_of_paths_sum[root] %= mod;
    // }
    // }
    // no_of_paths_including[root] *= no_of_paths_mul[root];
    // no_of_paths_including[root] %= mod;
    // no_of_paths_of_all_types[root] = (no_of_paths_ending_at[root] +
    // no_of_paths_including[root]) % mod;
    // System.out.println(root + " " + no_of_paths_ending_at[root] + " " +
    // no_of_paths_including[root] + " "
    // + no_of_paths_of_all_types[root]);
    // for (int i : adja[root]) {
    // if (i != parent[root]) {
    // long p = (no_of_paths_ending_at[i]
    // * Expo.a_pow_n_mod_m(no_of_paths_of_all_types[i], mod - 2, mod)) % mod;
    // long pp = (p * (no_of_paths_sum[root] - p + mod)) % mod;
    // no_of_paths_above[i] = (no_of_paths_of_all_types[root] - (p + pp) * mul + (2
    // * mod)) % mod;
    // }
    // }
    // st.pop();
    // } else {
    // b[root] = true;
    // for (int i : adja[root]) {
    // if (!b[i]) {
    // st.push(i);
    // parent[i] = root;
    // }
    // }
    // }
    // }
    // for (int i = 1; i <= n; i++) {
    // System.out.println(i + " " + no_of_paths_of_all_types[i]);
    // }
    // Arrays.fill(b, false);
    // int sptable[][] = new int[n + 1][24];
    // long prods[][] = new long[n + 1][24];
    // int level[] = new int[n + 1];
    // st.push(1);
    // while (!st.isEmpty()) {
    // int root = st.pop();
    // b[root] = true;
    // for (int i : adja[root]) {
    // if (!b[i]) {
    // st.push(i);
    // level[i] = level[root] + 1;
    // }
    // }
    // int j = 0;
    // sptable[root][0] = parent[root];
    // prods[root][0] = no_of_paths_above[root];
    // while (sptable[root][j] != 1) {
    // sptable[root][j + 1] = sptable[sptable[root][j]][j];
    // prods[root][j + 1] = (prods[root][j] * prods[sptable[root][j]][j]) % mod;
    // j++;
    // }
    // }
    // while (q-- > 0) {
    // int u = in.ni();
    // int v = in.ni();
    // int temp_u = u;
    // int temp_v = v;
    // if (level[u] > level[v]) {
    // u ^= v;
    // v ^= u;
    // u ^= v;
    // }
    // long ans = no_of_paths_mul[v];
    // int dist = level[v] - level[u];
    // while (dist > 0) {
    // int l = (int) (Math.log(dist));
    // dist -= 1 << l;
    // ans *= prods[v][l];
    // ans %= mod;
    // v = sptable[v][l];
    // }
    // if (u == v) {
    // ans *= no_of_paths_above[v];
    // ans %= mod;
    // System.out.println(ans);
    // } else {
    // for (int i = 23; i >= 0; i--) {
    // if (sptable[u][i] != -1 && sptable[v][i] != sptable[u][i]) {
    // ans *= prods[u][i];
    // ans %= mod;
    // ans *= prods[v][i];
    // ans %= mod;
    // u = sptable[u][i];
    // v = sptable[v][i];
    // }
    // }
    // int lca = parent[v];
    // long p = ((no_of_paths_ending_at[v] *
    // Expo.a_pow_n_mod_m(no_of_paths_of_all_types[v], mod - 2, mod))
    // + (no_of_paths_ending_at[u] * Expo.a_pow_n_mod_m(no_of_paths_of_all_types[u],
    // mod - 2, mod)))
    // % mod;
    // }
    // }
    // in.bw.flush();
    // }

    static class Expo {

        static long a_pow_n_mod_m(long a, long n, long m) {
            long ans = 1;
            while (n > 0) {
                if ((n & 1) == 1)
                    ans = (ans * a) % m;
                a = (a * a) % m;
                n >>= 1;
            }
            return ans;
        }

        static long a_pow_n(long a, long n) {
            long ans = 1;
            while (n > 0) {
                if ((n & 1) == 1)
                    ans *= a;
                a *= a;
                n >>= 1;
            }
            return ans;
        }
    }

    static class Data implements Comparable<Data> {

        int a, b;

        public Data(int a, int b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public int compareTo(Data o) {
            if (a == o.a) {
                return Integer.compare(b, o.b);
            }
            return Integer.compare(a, o.a);
        }

        public static void sort(int a[]) {
            Data d[] = new Data[a.length];
            for (int i = 0; i < a.length; i++) {
                d[i] = new Data(a[i], 0);
            }
            Arrays.sort(d);
            for (int i = 0; i < a.length; i++) {
                a[i] = d[i].a;
            }
        }
    }

    static class FastIO {

        private final BufferedReader br;
        private final BufferedWriter bw;
        private String s[];
        private int index;

        public FastIO(String[] args) throws IOException {
            if (args.length > 1) {
                br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(args[0]))));
                bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(args[1]))));
            } else {
                br = new BufferedReader(new InputStreamReader(System.in));
                bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));
            }
            s = br.readLine().split(" ");
            index = 0;
        }

        public int ni() throws IOException {
            return Integer.parseInt(nextToken());
        }

        public double nd() throws IOException {
            return Double.parseDouble(nextToken());
        }

        public long nl() throws IOException {
            return Long.parseLong(nextToken());
        }

        public String next() throws IOException {
            return nextToken();
        }

        public String nli() throws IOException {
            try {
                return br.readLine();
            } catch (IOException ex) {

            }
            return null;
        }

        public int[] gia(int n) throws IOException {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[] gia(int n, int start, int end) throws IOException {
            validate(n, start, end);
            int a[] = new int[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public double[] gda(int n) throws IOException {
            double a[] = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }

        public double[] gda(int n, int start, int end) throws IOException {
            validate(n, start, end);
            double a[] = new double[n];
            for (int i = start; i < end; i++) {
                a[i] = nd();
            }
            return a;
        }

        public long[] gla(int n) throws IOException {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }

        public long[] gla(int n, int start, int end) throws IOException {
            validate(n, start, end);
            long a[] = new long[n];
            for (int i = start; i < end; i++) {
                a[i] = nl();
            }
            return a;
        }

        public void print(String s) throws IOException {
            bw.write(s);
        }

        public void println(String s) throws IOException {
            bw.write(s);
            bw.newLine();
        }

        public void print(int s) throws IOException {
            bw.write(s + "");
        }

        public void println(int s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        public void print(long s) throws IOException {
            bw.write(s + "");
        }

        public void println(long s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        public void print(double s) throws IOException {
            bw.write(s + "");
        }

        public void println(double s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        private String nextToken() throws IndexOutOfBoundsException, IOException {
            if (index == s.length) {
                s = br.readLine().split(" ");
                index = 0;
            }
            return s[index++];
        }

        private void validate(int n, int start, int end) {
            if (start < 0 || end >= n) {
                throw new IllegalArgumentException();
            }
        }
    }
}
