#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)s; i < (int)e; ++i) #define all(a) (a).begin(), (a).end() int main() { cin.tie(nullptr); int N; cin >> N; vector A(2*N), B(2*N), X(N), Y(N); rep(i, 0, 2*N) cin >> A[i]; rep(i, 0, 2*N) cin >> B[i]; rep(i, 0, N) cin >> X[i]; rep(i, 0, N) cin >> Y[i]; ll ans = 0; rep(i, 0, N) { ll t1 = A[2*i] + A[2*i + 1] + X[i]; ll t2 = A[2*i] + B[2*i + 1] + Y[i]; ll t3 = B[2*i] + A[2*i + 1] + Y[i]; ll t4 = B[2*i] + B[2*i + 1] + X[i]; ans += max(max(t1, t2), max(t3, t4)); } cout << ans << '\n'; }