#include using namespace std; int main() { long long s = 0, t1, t2; long a[100000]; long b[100000]; long x[100000]; long y[100000]; int n, i; 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++) { t1 = a[i << 1] + a[(i << 1) + 1] + x[i]; t2 = a[i << 1] + b[(i << 1) + 1] + y[i]; if (t1 < t2) t1 = t2; t2 = b[i << 1] + a[(i << 1) + 1] + y[i]; if (t1 < t2) t1 = t2; t2 = b[i << 1] + b[(i << 1) + 1] + x[i]; if (t1 < t2) t1 = t2; s += t1; } cout << s << endl; }