#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

template<typename T>
ostream& operator<<(ostream &os, vector<T> &v){
    string sep = " ";
    if(v.size()) os << v[0];
    for(int i=1; i<v.size(); i++) os << sep << v[i];
    return os;
}

template<typename T>
istream& operator>>(istream &is, vector<T> &v){
    for(int i=0; i<v.size(); i++) is >> v[i];
    return is;
}

#ifdef DBG
void debug_(){ cout << endl; }
template<typename T, typename... Args>
void debug_(T&& x, Args&&... xs){
    cout << x << " "; debug_(forward<Args>(xs)...);
}
#define dbg(...) debug_(__VA_ARGS__)
#else
#define dbg(...)
#endif

ll rec(int l, int r, vector<ll> &a, vector<ll> &b){
    if(r-l==2) return max(a[l]+a[l+1], b[l]+b[l+1]);
    ll ret = 0;

    ret = max(ret, max(a[l]+a[r-1], b[l]+b[r-1]) + rec(l+1, r-1, a, b));
    for(int m=l+2; m<r; m+=2){
        ret = max(ret, rec(l, m, a, b)+rec(m, r, a, b));
    }

    return ret;
}



int main() {
    ios_base::sync_with_stdio(false);
    cout << setprecision(20) << fixed;
    int n; cin>>n;
    vector<ll> a(n), b(n);
    cin >> a >> b;

    // cout << rec(0, n, a, b) << endl;

    ll sa = 0;
    vector<ll> c0(n/2), c1(n/2);
    for(int i=0; i<n; i++){
        sa += a[i];
        if(i%2) c0[i/2] = b[i] - a[i];
        else c1[i/2] = b[i] - a[i];
    }

    sort(c0.rbegin(), c0.rend());
    sort(c1.rbegin(), c1.rend());

    vector<ll> s(n/2);
    s[0] = c0[0]+c1[0];

    for(int i=1; i<n/2; i++){
        s[i] = c0[i]+c1[i]+s[i-1];
    }

    ll ans = sa;
    for(int i=0; i<n/2; i++){
        ans = max(ans, sa+s[i]);
    }
    cout << ans << endl;

    return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template<class T> bool chmin(T& a,T b){if(a>b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b){if(a<b) {a = b; return true;} return false;}
#define all(x) (x).begin(),(x).end()
#define debug(x)  cerr << #x << " = " << (x) << endl;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vvec<ll> A(2,vec<ll>(N/2)),B = A;
    vvec<int> idx(2,vec<int>(N/2));
    for(int i=0;i<N;i++) cin >> A[i%2][i/2];
    for(int i=0;i<N;i++) cin >> B[i%2][i/2];
    ll sa = 0,sb = 0;
    for(int j=0;j<2;j++){
        iota(all(idx[j]),0);
        sort(all(idx[j]),[&](int a,int b){
            return A[j][a]-B[j][a]>A[j][b]-B[j][b];
        });
        sb += accumulate(all(B[j]),0LL);
    }
    ll ans = 0;
    for(int i=0;i<=N/2;i++){
        chmax(ans,sa+sb);
        if(i!=N/2){
            for(int j=0;j<2;j++){
                sa += A[j][idx[j][i]];
                sb -= B[j][idx[j][i]];
            }
        }
    }
    cout << ans << "\n";
}