// #include <atcoder/all>
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
/*-------------------------------------------*/

int n;
ll a[200009], b[200009];

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    cin >> n;
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];

    ll sum = 0;
    rep(i, n) sum += a[i];

    vector<int> odd, even;
    rep(i, n)(i & 1 ? odd : even).push_back(b[i] - a[i]);

    sort(ALL(odd), greater<int>());
    sort(ALL(even), greater<int>());

    ll ans = sum;
    rep(i, n / 2) chmax(ans, sum += odd[i] + even[i]);

    cout << ans << endl;

    return 0;
}
#include <cstdio>
#include <cctype>
namespace io{
	#define cs const
	#define il inline
	#define tpl template
	#define tpn typename
	typedef cs int&ci;
	typedef unsigned size_t;
	typedef cs size_t&cst;
#ifndef ONLINE_JUDGE
	using std::getchar;
	using std::putchar;
	using std::isdigit;
#else
	const size_t _I_Buffer_Size = 1 << 23, _O_Buffer_Size = 1 << 23;
	char _I_Buffer[_I_Buffer_Size],*_I_pos=_I_Buffer-1;
    const char *_I_end=_I_Buffer + _I_Buffer_Size;
    char _O_Buffer[_O_Buffer_Size],*_O_pos=_O_Buffer-1;
    const char *_O_end=_O_Buffer + _O_Buffer_Size,*_O_preend=_O_end-1;
    struct io{
		~io(){
			fwrite(_O_Buffer,1,_O_pos-_O_Buffer+1,stdout);
		}
	}ios;
    il char getchar(){
        return *((++_I_pos==_I_end)?fread(_I_Buffer,1,_I_Buffer_Size,stdin),_I_pos=_I_Buffer:_I_pos);
    }
    il bool isdigit(ci ch){
		return '0'<=ch;
	}
    il void putchar(ci x){
        *((_O_pos==_O_preend)?fwrite(_O_Buffer,1,_O_end-_O_Buffer,stdout),_O_pos = _O_Buffer:++_O_pos)=x;
    }
#endif
	template<typename T1>il void readuint(T1&x){
		int ch;
		while(!isdigit(ch=getchar()));
		for(x=ch^'0'; isdigit(ch=getchar()); x=x*10+(ch^'0'));
	}
	template<typename T>void writeuint(cs T&x){
		if(x>9)
			writeuint(x/10);
		putchar((x%10)|'0');
	}
	template<typename T>il void writelnuint(cs T&x){
		writeuint(x);
		putchar('\n');
	}
	#undef cs
	#undef il
	#undef tpl
	#undef tpn
}
#include <algorithm>
#define max_n 100000
using io::readuint;
using io::writelnuint;
using namespace std;
typedef long long ll;
int a[max_n];
#define a0 a
int main(){
	int n,k;
	readuint(n);
	int*a1=a+(k=n>>1);
	for(int*i=a1; --i>=a0; ){
		readuint(*i);
		readuint(*(i+k));
	}
	ll ans=0;
	for(int*i=a1,x; --i>=a0; ){
		readuint(x);
		*i-=x,ans+=x;
		readuint(x);
		*(i+k)-=x,ans+=x;
	}
	stable_sort(a0,a1),stable_sort(a1,a1+k);
	for(int*i=a1,x; --i>=a0&&(x=*i+*(i+k))>0; ans+=x);
	writelnuint(ans);
	return 0;
}