#include <bits/stdc++.h>
using namespace std;
#define mp(a, b) make_pair(a, b)
typedef pair<int, int> pii;
typedef long long ll;
const int maxn = 2e5 + 10;
const ll INF = 1e18;
ll sum;
ll g[2], f[maxn];
int n, a[maxn], b[maxn];
vector<ll> o, e;
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) 
	{
		scanf("%d", &a[i]);
		sum += a[i];
	}
	for(int i = 1; i <= n; ++i) 
	{
		scanf("%d", &b[i]);
		b[i] -= a[i];
	}
	for(int i = 1; i <= n; i += 2) o.push_back(b[i]);
	for(int i = 2; i <= n; i += 2) e.push_back(b[i]);
	sort(o.begin(), o.end(), greater<ll>());
	sort(e.begin(), e.end(), greater<ll>());
	for(int i = 0; i < o.size(); ++i)
	{
		if(o[i] + e[i] > 0)
			sum += o[i] + e[i];
		else
			break;
	}
	printf("%lld\n", sum);
	return 0;
}
/*
2
-2 0
0 -1
*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}
#ifdef LOCAL
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cerr<<(*i)<<" ";cerr<<endl;}
#else
template<class T>void pv(T a,T b){}
#endif

ll nextLong() { ll x; scanf("%lld", &x); return x;}

const ll INF = 1LL << 61;
const int MAX_N = 112345;
ll dp[MAX_N][3];

int main2() {

  int N = nextLong();
  vector<ll> A(N), B(N);
  REP(i, N) A[i] = nextLong();
  REP(i, N) B[i] = nextLong();

  ll s = accumulate(ALL(A), 0LL);

  vector<ll> c0, c1;
  REP(i, N) {
    if (i % 2 == 0) c0.push_back(B[i] - A[i]);
    if (i % 2 == 1) c1.push_back(B[i] - A[i]);
  }
  sort(ALL(c0)); reverse(ALL(c0));
  sort(ALL(c1)); reverse(ALL(c1));

  ll ans = s;
  REP(i, c0.size()) {
    ll gain = c0[i] + c1[i];
    if (gain > 0) ans += gain;
    else break;
  }

  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}
