// BISMILLAH
#include "bits/stdc++.h"
#define ll long long int
const int mxN = 500005, inf = 1000000005;
int N, a[2][mxN], b[2][mxN];
ll dp[2][mxN], dp1[2][mxN];
void init(int N) {
for (int i = 0; i < 2; i++) {
for (int j = 0; j < N; j++) {
dp[i][j] = dp1[i][j] = 0;
}
}
}
signed main() {
int testCases=1;
scanf("%lld",&testCases);
// std::cin >> testCases;
for (int T = 1; T <= testCases; T++) {
scanf("%d", &N);
for (int i = 0; i < 2; i++) {
for (int j = 0,x; j < N; j++) {
scanf("%d", &x);
a[i][j] = b[i][j] = x;
if (j > 0 && j+1 < N)
b[i][j] = -j - 1;
}
}
init(N);
dp[0][0] = dp1[0][0] = a[0][0];
for (int j = 1; j < N; j++) {
dp[0][j] = dp[0][j - 1] + std::max(a[0][j], b[0][j]);
}
for (int j = 1; j < N; j++) {
dp1[0][j] = dp[0][j - 1] + a[0][j];
}
dp[1][N-1] = dp1[1][N-1] = a[1][N-1];
for (int j = N-2; j >= 0; j--) {
dp[1][j] = dp[1][j + 1] + std::max(a[1][j], b[1][j]);
}
for (int j = N-2; j >= 0; j--) {
dp1[1][j] = dp[1][j + 1] + a[1][j];
}
ll ans = LLONG_MIN;
for (int j = 0; j < N; j++) {
ans = std::max(ans, dp1[0][j] + dp1[1][j]);
}
printf("%lld\n", ans);
// for (int i = 0;i < 2; i++) {
// for (int j = 0; j < N; j++) {
// printf("%lld ", dp1[i][j]);
// }
// printf("\n");
// }
}
return 0;
}
/*
*/