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

typedef long long ll;
int n;
const int maxn = 1e5 + 233;
int c[maxn], d[maxn];


int main(){
	vector<int> a, b;
	scanf("%d", &n);
	ll res = 0;
	for(int i = 1; i <= n; i++){
		scanf("%d", &c[i]);
		res += c[i];
	}
	for(int i = 1; i <= n; i++){
		scanf("%d", &d[i]);
		if(i & 1) a.push_back(d[i] - c[i]);
		else b.push_back(d[i] - c[i]);
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	while(!a.empty() && a.back() + b.back() > 0){
		res += a.back() + b.back();
		a.pop_back();
		b.pop_back();
	}
	printf("%lld\n", res);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair < int , int > pii;
#define mpr make_pair
#define FS first
#define SC second
#define PB push_back
template < typename T > void UMAX(T &a,T b){a=(a>b?a:b);}
template < typename T > void UMIN(T &a,T b){a=(a<b?a:b);}
LL readint(){
	char c=getchar();
	LL ret=0ll;
	bool neg=0;
	while(!(c>='0' && c<='9')){
		if(c=='-') neg=1;
		c=getchar();
	}
	while(c>='0' && c<='9'){
		ret=ret*10ll+(LL)(c-'0');
		c=getchar();
	}
	return neg?-ret:ret;
}
void putint(LL v){
	if(v<0){
		putchar('-');
		v=-v;
	}
	if(!v){
		putchar('0');
		return;
	}
	if(v>=10ll) putint(v/10ll);
	putchar('0'+(v%10ll));
}
int n,f[100005][2];
int main(){
	int i,j,k;
	n=readint();
	for(i=0;i<n;++i) f[i][i&1]=readint();
	for(i=0;i<n;++i) f[i][!(i&1)]=readint();
	LL sum=0;
	priority_queue < int > pq;
	for(i=0;i<n;++i){
		sum+=f[i][0];
		pq.push(f[i][1]-f[i][0]);
	}
	for(i=0;i<n/2;++i){
		sum+=pq.top();
		pq.pop();
	}
	printf("%lld\n",sum);
	return 0;
}
