#ifdef xay5421
#define D(...) fprintf(stderr,__VA_ARGS__)
#else
#define D(...) ((void)0)
#define NDEBUG
#endif
#include<bits/stdc++.h>
#define int long long
#define LL long long
#define MP make_pair
#define PB push_back
#define X first
#define Y second
#define SZ(x) ((int)(x).size())
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
typedef pair<int,int>PII;typedef vector<int>VI;typedef vector<PII>VII;
template<typename T>void rd(T&x){int f=0,c;while(!isdigit(c=getchar()))f^=!(c^45);x=(c&15);while(isdigit(c=getchar()))x=x*10+(c&15);if(f)x=-x;}
template<typename T>void pt(T x,int c=-1){if(x<0)putchar('-'),x=-x;if(x>9)pt(x/10);putchar(x%10+48);if(c!=-1)putchar(c);}
const int N=100005;
int n,len,A[N],B[N],C[N];
signed main(){
	rd(n);
	int sum=0;
	rep(i,1,n)rd(A[i]),sum+=A[i];
	rep(i,1,n){
		int x;rd(x),x-=A[i];
		if(i&1){
			B[++len]=x;
		}else{
			C[len]=x;
		}
	}
	sort(B+1,B+1+len,[&](int x,int y){return x>y;});
	sort(C+1,C+1+len,[&](int x,int y){return x>y;});
	int ans=sum;
	rep(i,1,len){
		sum+=B[i]+C[i];
		ans=max(ans,sum);
	}
	pt(ans,'\n');
	return 0;
}

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

int a[100010], b[100010];
long long dp[100010];
int s[100010];

int main () {
	int n; scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
	}
	for (int j = 1; j <= n; j++) {
		scanf("%d", &b[j]);
	}
	long long ans = 0;
	for (int i = 1; i <= n; i++) {
		if (a[i] > b[i]) s[i] = 0;
		else s[i] = 1;
		ans += max(a[i], b[i]);
	}
	int x = 0, y = 0;
	for (int i = 1; i <= n; i += 2) {
		if (s[i] == 0 && s[i + 1] == 1) x++;
		if (s[i] == 1 && s[i + 1] == 0) y++;
	}
	if (x == y) {
		printf("%lld\n", ans);
		return 0;
	}
	vector <int> all;
	if (x > y) {
		for (int i = 1; i <= n; i += 2) {
			if (s[i] != 1) all.push_back(b[i] - a[i]);
			if (s[i + 1] != 0) all.push_back(a[i + 1] - b[i + 1]);
		}
	} else {
		for (int i = 1; i <= n; i += 2) {
			if (s[i] != 0) all.push_back(a[i] - b[i]);
			if (s[i + 1] != 1) all.push_back(b[i + 1] - a[i + 1]);
		}
		swap(x, y);
	}
	sort(all.begin(), all.end()), reverse(all.begin(), all.end());
	int T = x - y;
	for (int i = 0; i < T; i++) {
		ans += all[i];
	}
	printf("%lld\n", ans);
	return 0;
}
