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.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;

public class Problem {
	public static void main(String[] args) throws Exception {
		Erickde scan = new Erickde();
		PrintWriter out = new PrintWriter(System.out);
		int t = scan.nextInt();
		for (int i = 0; i < t; i++) {
			int n = scan.nextInt();
			int sumR = 0, maxR = 0;
			for (int j = 0; j < n; j++) {
				sumR += scan.nextInt();
				maxR = Math.max(sumR, maxR);
			}
			int m = scan.nextInt();
			int sumB = 0, maxB = 0;
			for (int j = 0; j < m; j++) {
				sumB += scan.nextInt();
				maxB = Math.max(sumB, maxB);
			}
			System.out.println(maxR + maxB);
		}

	}

	void merge(int mPlusN[], int N[], int m, int n) {
		int i = n;

		int j = 0;

		int k = 0;

		while (k < (m + n)) {

			if ((i < (m + n) && mPlusN[i] <= N[j]) || (j == n)) {
				mPlusN[k] = mPlusN[i];
				k++;
				i++;
			} else {
				mPlusN[k] = N[j];
				k++;
				j++;
			}
		}
	}

	public static void moveZeroes(int[] nums) {
		int count = 0;
		for (int i = 0; i < nums.length; i++) {
			if (nums[i] == 0) {
				count++;
			}

		}
		while (count-- > 0) {
			for (int j = 0; j < nums.length - 1; j++) {
				if (nums[j] == 0) {
					int temp = nums[j];
					nums[j] = nums[j + 1];
					nums[j + 1] = temp;

				}
			}
		}
	}

	public static int[] twoSum(int[] nums, int target) {
		HashMap<Integer, Integer> sum = new HashMap<>();
		for (int i = 0; i < nums.length; i++) {
			int key = target - nums[i];
			if (sum.containsKey(key)) {
				return new int[] { sum.get(key), i };
			}
			sum.put(nums[i], i);
		}
		throw new IllegalArgumentException("Not found");

	}

	public boolean isValidSudoku(char[][] board) {
		HashSet seen = new HashSet();
		for (int i = 0; i < 9; i++) {
			for (int j = 0; j < board.length; j++) {
				char num = board[i][j];
				if (num != '.') {
					if ((!seen.add(num + "in row" + i)) || (!seen.add(num + "in col" + j))
							|| ((!seen.add(num + "in block" + i / 3 + "-" + j / 3)))) {
						return false;
					}
				}

			}
		}
		return true;

	}

	public void rotate(int[][] matrix) {
		int n = matrix.length;
		for (int i = 0; i < matrix.length; i++) {
			for (int j = i; j < n; j++) {
				int temp = matrix[i][j];
				matrix[i][j] = matrix[j][i];
				matrix[j][i] = temp;
			}
		}
		for (int i = 0; i < matrix.length; i++) {
			for (int j = 0; j < matrix.length / 2; j++) {
				int temp = matrix[i][j];
				matrix[i][j] = matrix[i][n - 1 - j];
				matrix[i][n - 1 - j] = temp;
			}
		}
	}

	public void reverseString(char[] s) {
		for (int i = 0; i < s.length / 2; i++) {
			char temp = s[i];
			s[i] = s[s.length - 1 - i];
			s[s.length - 1 - i] = temp;
		}
	}

	public int reverse(int x) {

		return x;

	}

	public int[] plusOne(int[] digits) {
		int s = digits.length;
		for (int i = s - 1; s > 0; i--) {
			if (digits[i] < 9) {
				digits[i]++;
				return digits;
			}
			digits[i] = 0;

		}
		int arr[] = new int[s + 1];
		arr[0] = 1;
		return arr;
	}

	static class Erickde {
		private int BS = 1 << 16;

		private char NC = (char) 0;
		private byte[] buf = new byte[BS];
		private int bId = 0, size = 0;
		private char c = NC;
		private double cnt = 1;
		private BufferedInputStream in;

		public Erickde() {
			in = new BufferedInputStream(System.in, BS);
		}

		public Erickde(String s) {
			try {
				in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
			} catch (Exception e) {
				in = new BufferedInputStream(System.in, BS);
			}
		}

		private char getChar() {
			while (bId == size) {
				try {
					size = in.read(buf);
				} catch (Exception e) {
					return NC;
				}
				if (size == -1)
					return NC;
				bId = 0;
			}
			return (char) buf[bId++];
		}

		public int nextInt() {
			return (int) nextLong();
		}

		public int[] nextInts(int N) {
			int[] res = new int[N];
			for (int i = 0; i < N; i++) {
				res[i] = (int) nextLong();
			}
			return res;
		}

		public long[] nextLongs(int N) {
			long[] res = new long[N];
			for (int i = 0; i < N; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public long nextLong() {
			cnt = 1;
			boolean neg = false;
			if (c == NC)
				c = getChar();
			for (; (c < '0' || c > '9'); c = getChar()) {
				if (c == '-')
					neg = true;
			}
			long res = 0;
			for (; c >= '0' && c <= '9'; c = getChar()) {
				res = (res << 3) + (res << 1) + c - '0';
				cnt *= 10;
			}
			return neg ? -res : res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c != '.' ? cur : cur + nextLong() / cnt;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while (c <= 32)
				c = getChar();
			while (c > 32) {
				res.append(c);
				c = getChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while (c <= 32)
				c = getChar();
			while (c != '\n') {
				res.append(c);
				c = getChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if (c > 32)
				return true;
			while (true) {
				c = getChar();
				if (c == NC)
					return false;
				else if (c > 32)
					return true;
			}
		}
	}

	public static void quicksort(int[] a) {
		if (a == null)
			return;
		quicksort(a, 0, a.length - 1);
	}

	private static void quicksort(int[] a, int lo, int hi) {
		if (lo < hi) {
			int splitPoint = partition(a, lo, hi);
			quicksort(a, lo, splitPoint);
			quicksort(a, splitPoint + 1, hi);
		}
	}

	private static final double EPS = 0.00000001;

	private static int partition(int[] a, int lo, int hi) {
		int pivot = a[lo];
		int i = lo - 1, j = hi + 1;
		while (true) {
			do {
				i++;
			} while (a[i] < pivot);
			do {
				j--;
			} while (a[j] > pivot);
			if (i < j)
				swap(a, i, j);
			else
				return j;
		}
	}

	private static void swap(int[] ar, int i, int j) {
		int tmp = ar[i];
		ar[i] = ar[j];
		ar[j] = tmp;
	}

	static Random RANDOM = new Random();

	static int randInt(int min, int max) {
		return RANDOM.nextInt((max - min) + 1) + min;
	}

	public static int findMaxGCD(int arr[], int n) {

		int high = 0;
		for (int i = 0; i < n; i++)
			high = Math.max(high, arr[i]);

		int divisors[] = new int[high + 1];

		for (int i = 0; i < n; i++) {

			for (int j = 1; j <= Math.sqrt(arr[i]); j++) {

				if (arr[i] % j == 0) {

					divisors[j]++;

					if (j != arr[i] / j)
						divisors[arr[i] / j]++;
				}
			}
		}

		for (int i = high; i >= 1; i--)

			if (divisors[i] > 1)
				return i;
		return 1;
	}

	static int arraySortedOrNot(int arr[], int n) {

		if (n == 1 || n == 0)
			return 1;

		if (arr[n - 1] < arr[n - 2])
			return 0;

		return arraySortedOrNot(arr, n - 1);
	}

	static boolean isPrime(int n) {

		if (n <= 1)
			return false;

		else if (n == 2)
			return true;

		else if (n % 2 == 0)
			return false;

		for (int i = 3; i <= Math.sqrt(n); i += 2) {
			if (n % i == 0)
				return false;
		}
		return true;
	}

	public int removeDuplicates(int[] nums) {
		if (nums.length < 2) {
			return nums.length;
		}
		int i = 1;
		int j = 0;
		while (i < nums.length) {
			if (nums[i] != nums[j]) {
				j++;
				nums[j] = nums[i];
			}
			i++;
		}
		return j + 1;
	}

	public static boolean containsDuplicate(int[] nums) {
		HashSet<Integer> numbers = new HashSet<>();
		for (int i = 0; i < nums.length; i++) {
			if (numbers.contains(nums[i])) {
				return true;
			} else {
				numbers.add(nums[i]);
			}
		}
		return false;

	}

	public int singleNumber(int[] nums) {
		int res = 0;
		for (int i = 0; i < nums.length; i++) {
			res ^= nums[i];
		}
		return res;

	}

}
