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

#define ll long long
#define pii pair<int, int>
#define F first
#define S second
#define all(c) ((c).begin()), ((c).end())
#define sz(x) ((int)(x).size())
#define ld long double

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<", "<<p.second<<")";
	return os;
}

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

#ifdef LOCAL
#define cerr cout
#else
#endif

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

const int N = 100005;
const int M = N / 4;

const ll INF = 1LL << 60;

int A[N], B[N], perm[N];
ll cost[2][N];
int main(){
	int n; cin >> n;
	ll ans = 0;
	for(int i = 1; i <= n; i++) cin >> A[i], ans += A[i];
	for(int i = 1; i <= n; i++) cin >> B[i], perm[i] = i;
	sort(perm + 1, perm + n + 1, [&](int i, int j){return B[i] - A[i] > B[j] - A[j];});
	vector<int> num(2, 0);
	for(int i = 1; i <= n; i++){
		int ind = perm[i];
		int j = ind % 2;
		num[j]++;
		cost[j][num[j]] = cost[j][num[j] - 1] + B[ind] - A[ind]; 
	}
	ll val = ans;
	for(int i = 1; i <= n / 2; i++){
		ans = max(ans, val + cost[0][i] + cost[1][i]);
	}
	cout << ans << endl;
}
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define eps (double)(1e-9)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    rep(i, n)cin >> a[i];
    rep(i, n)cin >> b[i];
    vector<int> even, odd;
    rep(i, n){
        if(i % 2 == 0)even.push_back(b[i]-a[i]);
        else odd.push_back(b[i]-a[i]);
    }
    sort(rall(even)); sort(rall(odd));
    ll ans = accumulate(all(a), 0LL);
    rep(i, n/2)ans += max(0, even[i]+odd[i]);
    cout << ans << endl;
}