// #include <atcoder/all>
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
/*-------------------------------------------*/

int n;
ll a[200009], b[200009];

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    cin >> n;
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];

    ll sum = 0;
    rep(i, n) sum += a[i];

    vector<int> odd, even;
    rep(i, n)(i & 1 ? odd : even).push_back(b[i] - a[i]);

    sort(ALL(odd), greater<int>());
    sort(ALL(even), greater<int>());

    ll ans = sum;
    rep(i, n / 2) chmax(ans, sum += odd[i] + even[i]);

    cout << ans << endl;

    return 0;
}
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int h, w, n, m;
    cin >> h >> w >> n >> m;
    vector<int> A(n), B(n), C(m), D(m);
    vector<vector<int>> g(h + 2, vector<int>(w + 2, 0));
    for (int i = 0; i < n; ++i) {
        cin >> A[i] >> B[i];
        g[A[i]][B[i]] = 1;
    }
    for (int i = 0; i < m; ++i) {
        cin >> C[i] >> D[i];
        g[C[i]][D[i]] = -1;
    }

    auto x = g;
    for (int i = 0; i < h; ++i) {
        int c = 0;
        for (int j = 0; j < w; ++j) {
            x[i + 1][j + 1] += c;
            if (g[i + 1][j + 1] >= 0) c += g[i+1][j+1];
            else c = 0;
        }
    }
    for (int i = 0; i < h; ++i) {
        int c = 0;
        for (int j = w-1; j >= 0; --j) {
            x[i + 1][j + 1] += c;
            if (g[i + 1][j + 1] >= 0) c += g[i+1][j+1];
            else c = 0;
        }
    }
    for (int j = 0; j < w; ++j) {
        int c = 0;
        for (int i = 0; i < h; ++i) {
            x[i + 1][j + 1] += c;
            if (g[i + 1][j + 1] >= 0) c += g[i+1][j+1];
            else c = 0;
        }
    }
    for (int j = 0; j < w; ++j) {
        int c = 0;
        for (int i = h-1; i >= 0; --i) {
            x[i + 1][j + 1] += c;
            if (g[i + 1][j + 1] >= 0) c += g[i+1][j+1];
            else c = 0;
        }
    }
    int ans = 0;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if(g[i+1][j+1] >= 0)ans += x[i+1][j+1] > 0;
        }
    }
    cout << ans << "\n";
    return 0;
}