#include <bits/stdc++.h>
 
#define int long long
 
#define pii pair<int, int>
 
#define x1 x1228
#define y1 y1228
 
#define left left228
#define right right228

#define tm tm228
 
#define pb push_back
#define eb emplace_back
 
#define mp make_pair                                                                
                                                                                                                                        
#define ff first                                                                  
#define ss second   
 
#define all(x) x.begin(), x.end()
#define debug(x) cout << #x << ": " << x << endl; 
#define TIME (ld)clock()/CLOCKS_PER_SEC
 
using namespace std;
typedef long long ll; 
typedef long double ld; 
                                                                                                   
const int maxn = 3e5 + 7, mod = 1e9 + 7, MAXN = 1e6 + 7;
const double eps = 1e-9;
const ll INF = 1e18, inf = 1e15;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
int n; 
int a[maxn], b[maxn]; 

void solve() {
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> a[i];
    for (int i = 0; i < n; ++i) cin >> b[i];
    int cur = 0;
    for (int i = 0; i < n; ++i) cur += a[i];
    vector<int> odd, even;
    for (int i = 0; i < n; i += 2) odd.pb(b[i] - a[i]);
    for (int i = 1; i < n; i += 2) even.pb(b[i] - a[i]);
    sort(all(odd));
    reverse(all(odd)); 

    sort(all(even));
    reverse(all(even)); 

    int ans = cur; 
    int c = 0; 
    for (int i = 0; i < n / 2; ++i) {
        c += odd[i] + even[i]; 
        ans = max(ans, cur + c); 
    } 
    cout << ans; 
}                                 
   
signed main() {
#ifdef LOCAL
    freopen("TASK.in", "r", stdin);
    freopen("TASK.out", "w", stdout);
#else 
    
#endif // LOCAL
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20); 
    cout << fixed; 
    int t = 1; 
    for (int i = 0; i < t; ++i) {              
        solve();
    }
    return 0;
} 
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<vector>
#include<set>
#define ll long long
const int maxn = 2e5 + 10;
using namespace std;
int m = 0, n, cha[maxn], l, r, qz[maxn], a[maxn], b[maxn];
int main(){
    ll res = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
    }
    for (int i = 0; i < n; ++i) {
        scanf("%d", &b[i]); res += b[i];
    }
    for (int i = 0; i < n; ++i) {
        if(i & 1) qz[i / 2] = a[i] - b[i];
        else cha[i / 2] = a[i] - b[i];
    }
    sort(qz, qz + n / 2);
    reverse(qz, qz + n / 2);
    sort(cha, cha + n / 2); reverse(cha, cha + n / 2);
    while (m < n / 2){
        if(qz[m] + cha[m] <= 0) break;
        else {
            res += qz[m] + cha[m]; m++;
        }
    }
    printf("%lld\n", res);
}
