#include <iostream>
#include <algorithm>
#include <string.h>
#include <vector>
using namespace std;
typedef long long ll;
const int N=1e5+10;
ll n;
ll a[N],b[N];
ll res,sum;
vector<int>	v[2];
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)	cin>>a[i],sum+=a[i];
	for(int i=1;i<=n;i++){
		cin>>b[i];
		b[i]=b[i]-a[i];
		if(i%2)	v[1].push_back(b[i]);
		else	v[0].push_back(b[i]);
	}
	sort(v[1].begin(),v[1].end());
	sort(v[0].begin(),v[0].end());
	res=sum;
	for(int i=v[1].size()-1;i>=0;i--){
		sum+=v[0][i]+v[1][i],res=max(res,sum);
	}
	cout<<res;
	return 0;
}
#include <bits/stdc++.h>
#define rep(i, x, y) for (int i = x; i <= y; i++)
using namespace std;

typedef long long ll;
const int N = 1e5 + 10;
ll tot = 0;
int n, a[N], b[N];
priority_queue<int> q[2];

int main() {
    cin >> n;
    rep(i, 1, n) scanf("%d", &a[i]), tot += a[i];
    rep(i, 1, n) scanf("%d", &b[i]), q[i & 1].push(b[i] - a[i]);
    while (q[0].size() && q[1].size() && q[0].top() + q[1].top() > 0) {
        tot += q[0].top() + q[1].top(), q[0].pop(), q[1].pop();
    }
    printf("%lld\n", tot);
    return 0;
}
