#include<bits/stdc++.h>
using namespace std;
template<typename T>inline T read(){
	T x=0,f=0;char c=getchar();
	while(!isdigit(c)) f=c=='-',c=getchar();
	while(isdigit(c)) x=x*10+c-48,c=getchar();
	return f?-x:x;
}
#define int long long
namespace run{
	const int N=1e5+9;
	int n,a[N],b[N],ans;
	priority_queue<int> pq[2];
	int main(){
		n=read<int>();
		for(int i=1;i<=n;i++) ans+=(a[i]=read<int>());
		for(int i=1;i<=n;i++) b[i]=read<int>();
		for(int i=1;i<=n;i++) pq[i&1].push(b[i]-a[i]);
		while(!pq[0].empty() && !pq[1].empty() && pq[0].top()+pq[1].top()>0){
			ans+=pq[0].top()+pq[1].top();
			pq[0].pop(),pq[1].pop();
		}
		printf("%lld\n",ans);
		return 0;
	}
}
#undef int
int main(){
#ifdef my
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
#endif
	return run::main();
}
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
#define per(i,r,l) for(int i=(r);i>=(l);--i)
using namespace std;
typedef long long ll;
const int N=1e5+10;
int n,a[N],b[N],c[N],x;ll ans;
int main(){
	scanf("%d",&n);
	rep(i,1,n) scanf("%d",a+i),ans+=a[i];
	rep(i,1,n) scanf("%d",&x),i&1?b[i+1>>1]=x-a[i]:c[i>>1]=x-a[i];
	sort(b+1,b+(n>>1)+1);sort(c+1,c+(n>>1)+1);
	rep(i,1,n>>1) if(b[i]+c[i]>0) ans+=b[i]+c[i];
	printf("%lld\n",ans);
	return 0;
}