#include using namespace std; int main() { long long s = 0, t1, t2; long a[200000]; long b[200000]; long x[100000]; long y[100000]; int n, i, q, h; cin >> n; for (i = 0; i < (n << 1); i++) { cin >> a[i]; } for (i = 0; i < (n << 1); i++) { cin >> b[i]; } for (i = 0; i < n; i++) { cin >> x[i]; } for (i = 0; i < n; i++) { cin >> y[i]; } for (i = 0; i < n; i++) { q = i << 1; h = q + 1; t1 = a[q] + a[h] + x[i]; t2 = a[q] + b[h] + y[i]; if (t1 < t2) t1 = t2; t2 = b[q] + a[h] + y[i]; if (t1 < t2) t1 = t2; t2 = b[q] + b[h] + x[i]; if (t1 < t2) t1 = t2; s += t1; } cout << s << endl; }