#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define endl '\n'
#define Endl '\n'
using namespace std;
const int N = 2e5 + 5;
int tc, n, m, a[N], b[N], c[N];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); // cout.tie(0);
cin >> tc;
while (tc--) {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n; i++) {
cin >> b[i];
}
for (int i = 0; i < n; i++) {
c[i] = a[i] - b[i];
}
ll sum = 0;
for (int i = 0; i < n; i++) {
sum += max({a[i], b[i], c[i]});
}
cout << sum << endl;
}
return 0;
}