# include <bits/stdc++.h>
using namespace std;
# define rep(i,a,n) for (int i=a; i<=n; ++i)
# define per(i,a,n) for (int i=a; i>=n; --i)
# define bug puts("H");
# define pb push_back
# define mp make_pair
# define all(x) (x).begin(), (x).end()
# define SZ(x) (int)x.size()
# define fi first
# define se second
# define lch p<<1,l,mid
# define rch p<<1|1,mid+1,r
# define mem(a,b) memset(a,b,sizeof(a))
# define INF 1000000001
# define MOD 1000000007
typedef vector<int> Vi;
typedef long long i64;
typedef pair<int, int> Pi;
mt19937 mrand(random_device{}());
int rnd(int x) {return mrand()%x;}
i64 powmod(i64 a, i64 b){i64 res=1;a%=MOD;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}
i64 Inv(i64 b){return powmod(b,(i64)MOD-2);}
typedef long long ll;

const int N = 100005;
const double eps = 1e-9;
const double inf = 1e18;

int a[N], b[N];
Vi odd, even;

bool comp(int aa, int bb) {return aa>bb;}
int main ()
{
    int n;
    i64 sum = 0;
    scanf("%d", &n);
    rep(i,1,n) scanf("%d", a+i), sum += a[i];
    rep(i,1,n) {
        scanf("%d", b+i), b[i] -= a[i];
        if (i&1) odd.pb(b[i]);
        else even.pb(b[i]);
    }
    sort(all(odd), comp);
    sort(all(even), comp);
    rep(i,0,n/2-1) {
        if (odd[i]+even[i] > 0) sum += odd[i]+even[i];
    }
    printf("%lld\n", sum);
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;
#define fst first
#define snd second

const int N = 1e5 + 5;
int a[N], b[N];

//ll dp[N][2][2];
//const ll INF = 1e18;

VI diff[2];

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#endif

  int n;
  cin >> n;
  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    ans += a[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
    b[i] -= a[i];
  }

  //  dp[0][0][1] = dp[0][1][1] = -INF;
  //  for (int i = 1; i <= n; i++) {
  //    for (int p : {0, 1}) {
  //      for (int nb : {0, 1}) {
  //        dp[i][p][nb] = dp[i - 1][p][nb];
  //      }
  //    }
  //    int p = i & 1;
  //    for (int nb : {0, 1}) {
  //      dp[i][p][nb] = max(dp[i][p][nb], dp[i - 1][1 - p][1 - nb] + b[i]);
  //    }
  //  }
  //  ans += max(dp[n][0][0], dp[n][1][0]);

  for (int i = 1; i <= n; i++) {
    diff[i & 1].push_back(b[i]);
  }
  sort(diff[0].begin(), diff[0].end());
  sort(diff[1].begin(), diff[1].end());

  while (!diff[0].empty() && !diff[1].empty()) {
    ll cur = diff[0].back() + diff[1].back();
    diff[0].pop_back();
    diff[1].pop_back();
    if (cur > 0) ans += cur;
  }

  cout << ans << endl;

  return 0;
}
