#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
int t;
cin >> t;
while (t--){
int n;
cin >> n;
ll a[2][n + 1], dp[2][n + 1];
for (int i = 0; i < 2; i++){
for (int j = 1; j <= n; j++){
cin >> a[i][j];
dp[i][j] = 0;
}
}
dp[1][0] = -1e18;
dp[0][1] = a[0][1];
for (int i = 1; i < n; i++){
if (i > 1) dp[0][i] = dp[0][i - 1] + max(a[0][i], 1LL * (-i));
dp[1][i] = max(dp[0][i] + a[1][i], dp[1][i - 1] + max(a[1][i], 1LL * (-i)));
}
cout << max(dp[0][n - 1] + a[0][n], dp[1][n - 1]) + a[1][n] << endl;
}
}