#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
#include <utility>


using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define REP(i, n) for(int i = 0;i < (n);i++)
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=1000000007;
const llint inf=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-10;
template <class T,class U>bool chmin(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool chmax(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void){
	int i,j,n;cin>>n;
	llint ans=0;
	vector<int>sco(n);
	for(i=0;i<n;i++){llint A;cin>>A;ans+=A;sco[i]=-A;}
	for(i=0;i<n;i++){llint B;cin>>B;sco[i]+=B;}
	vector<llint>gu(n/2);
	vector<llint>ki(n/2);
	for(i=0;i<n/2;i++){
		gu[i]=sco[i+i];
		ki[i]=sco[i+i+1];
	}
	SO(gu);SO(ki);
	for(i=n/2-1;i>=0;i--){
		if(gu[i]+ki[i]>0){ans+=gu[i]+ki[i];}
		else{break;}
	}
	cout<<ans<<endl;
	return 0;
}
#include <bits/stdc++.h>
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define RI register int
typedef long long LL;
#define int LL

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

namespace IO {
  char buf[1000000], *p1 = buf, *p2 = buf;
  inline char gc() {
    if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
    return p1 == p2 ? EOF : *(p1++);
  }
  template <class T> inline void read(T &n) {
    n = 0; RI ch = gc(), f;
    while ((ch < '0' || ch > '9') && ch != '-') ch = gc();
    f = (ch == '-' ? ch = gc(), -1 : 1);
    while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
    n *= f;
  }
  char Of[105], *O1 = Of, *O2 = Of;
  template <class T> inline void print(T n, char ch = '\n') {
    if (n < 0) putchar('-'), n = -n;
    if (n == 0) putchar('0');
    while (n) *(O1++) = (n % 10) ^ 48, n /= 10;
    while (O1 != O2) putchar(*(--O1));
    putchar(ch);
  }
}

using IO :: read;
using IO :: print;

int const MAXN = 1e5 + 5;
int a[MAXN], b[MAXN];
priority_queue <int> q1, q2;

signed main() {
  
#ifdef LOCAL
  FILEIO("a");
#endif

  int n; read(n);
  for (RI i = 1; i <= n; ++i) read(a[i]);
  for (RI i = 1; i <= n; ++i) read(b[i]);
  LL ans = 0;
  for (RI i = 1; i <= n; ++i) {
    ans += a[i];
    if (i & 1)
      q1.push(b[i] - a[i]);
    else
      q2.push(b[i] - a[i]);
  }
  while (!q1.empty() && !q2.empty() && q1.top() + q2.top() > 0) {
    ans += q1.top() + q2.top();
    q1.pop(), q2.pop();
  }
  print(ans);
  
  return 0;
}

// created by Daniel yuan
/*
     ________
    /        \
   / /      \ \
  / /        \ \
  \            /
   \  ______  /
    \________/
*/
