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

# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ;

# define ll long long
# define C continue;

# define pb push_back
# define vi vector < int >
# define vll vector < ll >

# define I insert

# define pii pair < int , int >
# define pll pair < ll , ll >
# define F first
# define S second

# define vpii vector < pair < int , int > >
# define vpll vector < pll >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()

# define ld long double
# define PQ priority_queue

# define vc vector < char >
# define vb vector < bool >
# define vs vector < string >

# define vvi vector < vector < int > >
# define vvll vector < vector < ll > >
# define vvc vector < vector < char > >
# define vvb vector < vector < bool > >

# define allcomp(v) v.begin() , v.end() , comp

# define pp(n) printf("%.10Lf",n);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

string vow = "aeiou";
int month[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

const int dx[] = { -1 , 0 , 1 , 0 , -1 , -1 , 1 , 1 } ;
const int dy[] = { 0 , 1 , 0 , -1 , -1 , 1 , -1 , 1 } ;

const ld pie = 3.1415926535897932384626 ;
const ll mod = 1e9 + 7 ;

/// Tip : If a and b are positive integers ; we may say - ceil (a/b) = 1 + floor ( (a-1)/b ) .
/// Start using lower bound !!

void solve ( int test_case )
{
    int n ;
    cin >> n ;

    ll s = 0 ;
    ll &sum = s ;

    vi v ( n ) ;
    for ( int i=0 ; i < n ; i ++ )
    {
        int &val = v[i] ;
        cin >> val ;

        s += val ;
    }

    vvi temp ( 2 ) ;

    for ( int i=0 ; i < n ; i ++ )
    {
        int val ;
        cin >> val ;

        val = val - v[i] ;

        temp[i&1].pb ( val ) ;
    }

    sort ( allrev ( temp[0] ) ) ;
    sort ( allrev ( temp[1] ) ) ;

    int z = min ( temp[0].size() , temp[1].size() ) ;

    for ( int i=0 ; i < z ; i ++ )
    {
        int add = temp[0][i] + temp[1][i] ;

        if ( add <= 0 )
            break ;

        sum += add ;
    }

    cout << sum ; line ;
}

int main()
{
    int t = 1;
    // cin >> t;

    for ( int i = 1 ; i <= t ; i ++ )
    {
        solve ( i ) ;
    }

    return 0;
}

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }

template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }

template<class T> void chmin(T &a, const T &b){ a = (a < b ? a : b); }
template<class T> void chmax(T &a, const T &b){ a = (a > b ? a : b); }


int main() {
    int n;
    cin >> n;
    vector<int> A(n), B(n);
    for (auto &&i : A) scanf("%d", &i);
    for (auto &&i : B) scanf("%d", &i);
    ll ans = 0;
    for (int i = 1; i < n; i += 2) {
        swap(A[i], B[i]);
    }
    priority_queue<int> Q;
    for (int i = 0; i < n; ++i) {
        ans += A[i];
        Q.emplace(B[i]-A[i]);
    }
    for (int i = 0; i < n/2; ++i) {
        ans += Q.top(); Q.pop();
    }
    cout << ans << "\n";
    return 0;
}