/* -*- coding: utf-8 -*- * * 2196.cc: No.2196 Pair Bonus - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 100000; const int MAX_N2 = MAX_N * 2; /* typedef */ typedef long long ll; /* global variables */ int as[MAX_N2], bs[MAX_N2], xs[MAX_N], ys[MAX_N]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); int n2 = n * 2; for (int i = 0; i < n2; i++) scanf("%d", as + i); for (int i = 0; i < n2; i++) scanf("%d", bs + i); for (int i = 0; i < n; i++) scanf("%d", xs + i); for (int i = 0; i < n; i++) scanf("%d", ys + i); ll sum = 0; for (int i = 0; i < n; i++) { int j0 = i * 2, j1 = i * 2 + 1; sum += max((ll)xs[i] + max(as[j0] + as[j1], bs[j0] + bs[j1]), (ll)ys[i] + max(as[j0] + bs[j1], bs[j0] + as[j1])); } printf("%lld\n", sum); return 0; }