#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mx = 2e5+9;
const int mn = -1e15;
int a[3][mx], n;
int dp[mx][3][2];
int dyno (int x, int y, int z) {
if (y == n+1) return mn;
else if (x == 2 && y == n) return a[x][y];
else if (dp[y][x][z] != LLONG_MIN) return dp[y][x][z];
int ans;
if (z) {
ans = a[x][y]+max(dyno(x, y+1, 0), dyno(x, y+1, 1));
if (x == 1) ans = max (ans, a[x][y]+dyno(2, y, 1));
}
else {
ans = -1LL*y+max(dyno(x, y+1, 0), dyno(x, y+1, 1));
}
return dp[y][x][z] = ans;
}
int32_t main () {
cin.tie(0)->sync_with_stdio(0);
int t = 1;
cin >> t;
while (t--) {
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[1][i];
for (int i = 1; i <= n; i++) cin >> a[2][i];
for (int i = 1; i <= n+1; i++) {
for (int j = 0; j <= 2; j++) {
dp[i][j][0] = dp[i][j][1] = LLONG_MIN;
}
}
cout << dyno (1, 1, 1) << "\n";
}
}