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].
#include <bits/stdc++.h>
#include <numeric>
#define ll long long
#define ull unsigned long long
#define myswap(a,b) a^=b^=a^=b
#define sync ios::sync_with_stdio(false),cin.tie(0)
#define debug(x)cout<<"debug  "<<x<<endl
#define debug2(i,x)cout<<"debug2  "<<i<<' '<<x<<endl
#define debug3(a,b,c)cout<<"debug3  "<<a<<' '<<b<<' '<<c<<endl
#define debug4(a,b,c,d)cout<<"debug4  "<<a<<' '<<b<<' '<<c<<' '<<d<<endl
#define debug5(a,b,c,d,e)cout<<"debug5  "<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<endl
#define debugxy(x,y)cout<<'('<<x<<','<<y<<')'<<endl
#define Init(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define lowbit(x) (x&-x)
#define endl '\n'
//#define x first
//#define y second
const int N=1e6+5;
const int mod=998244353;
const double PI=acos(-1.0);
const double eps=1e-8;
using namespace std;
template<typename T>
T gcd(T a,T b){return (b == 0 ? a : gcd(b, a%b));}
//ll inv(ll a){ll p=mod-2;ll ans=1;while(p>0){if(p&1)ans=ans*a%mod;a=(a*a)%mod;p>>=1;}return ans;}
//ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
//ll qpow(ll a,ll b){ll ans=1; a%=mod; for(;b;b>>=1,a=a*a%mod) if(b&1)ans=(ans*a)%mod; return ans%mod;}
//inline int read(){int num = 0, w = 0; char ch = 0;while (!isdigit(ch)){w |= ch == '-';ch = getchar();}while (isdigit(ch)){num = (num << 3) + (num << 1) + (ch ^ 48);ch = getchar();}return w ? -num : num;}
//bool ispow2(ll n){return (n&(n-1))==0;}
//void getprime(int mx){for(int i=2;i<=mx;++i){if(!minprime[i])prime.push_back(i),minprime[i]=i;for(int j=0;j<prime.size() && prime[j]*i<=mx;++j){minprime[i*prime[j]]=prime[j];if(i%prime[j]==0)break;}}}

int t,n,m,a[111],b[111],prea[111],preb[111],dp[111][111];
int solve()
{
    cin>>n;
    for(int i=0;i<n;++i)
    {
        cin>>a[i];
        prea[i]=0;
    }
    cin>>m;
    for(int i=0;i<m;++i)
    {
        cin>>b[i];
        preb[i]=0;
    }
    int ans=0;
    prea[0]=a[0],preb[0]=b[0];
    ans=max(ans,max(a[0],b[0]));
    for(int i=1;i<n;++i)prea[i]=prea[i-1]+a[i],ans=max(ans,prea[i]);
    for(int i=1;i<m;++i)preb[i]=preb[i-1]+b[i],ans=max(ans,preb[i]);
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<m;++j)
            ans=max(ans,prea[i]+preb[j]);
    }
    return ans;
}
int main()
{
    sync;
    cin>>t;
    while(t--)
        //solve();
    cout<<solve()<<endl;
    //cout<<(solve()?"YES":"NO")<<endl;
    return 0;
}
/*


*/
