#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline T int_ceil(T a, T b) { T res = a / b; if(a % b != 0) res++; return res; }
#include <bits/stdc++.h>
using namespace std;
template<typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
// sort(ALL(v), [](auto const& lhs, auto const& rhs) { return lhs > rhs; /* 左の方が大きい...というイメージ。*/ });
// --------------------------------------------------------------------------------------------- //

static const int MAX = 100001;
static const ll MOD = 1000000007;


int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	ll N; cin >> N;
	vector<ll> A(N), B(N), AmB(N);
	rep(i, N){
		cin >> A[i];
	}
	ll sum = 0;
	rep(i, N) {
		cin >> B[i];
		sum += B[i];
		AmB[i] = A[i] - B[i];
	}
	priority_queue<ll> gu, ki;
	rep(i, N){
		if(i % 2 == 0){
			gu.push(AmB[i]);
		}
		else{
			ki.push(AmB[i]);
		}
	}

	ll ans = sum;
	while(!gu.empty()){
		ll a = gu.top(), b = ki.top();
		gu.pop(), ki.pop();
		chmax(ans, ans + a + b);
	}
	cout << ans << endl;


	return 0;
}

#pragma GCC optimize("O3")
#include <stdio.h>
#include <bits/stdc++.h>

int main()
{
	int i, N, A[2][131072];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d", &(A[0][i]));
	for (i = 1; i <= N; i++) scanf("%d", &(A[1][i]));
	
	int j, k, l, r;
	const long long inf = -(1LL << 60);
	long long dp[2][131072];
	for (i = 0; i <= N; i++) {
		dp[0][i] = inf;
		dp[1][i] = inf;
	}
	dp[0][1] = A[0][1];
	dp[1][1] = A[1][1];
	for (i = 2; i <= N; i++) {
		if (i % 2 == 0) {
			dp[0][0] = dp[0][1] + A[0][i];
			if (dp[0][0] < dp[1][1] + A[1][i]) dp[0][0] = dp[1][1] + A[1][i];
		} else dp[1][0] = dp[0][0];
		k = (i < N - i)? i: N - i;
		l = i % 2;
		r = 1 - i % 2;
        long long ar = A[r][i], al = A[l][i];
        #pragma unroll(4)
		for (j = 2 - l; j <= k; j += 2) {
			dp[0][j] = std::max(dp[0][j-1] + ar, dp[0][j+1] + al);
		}
        #pragma unroll(4)
        for (j = 2 - l; j <= k; j += 2) {
			dp[1][j] = std::max(dp[1][j-1] + al, dp[1][j+1] + ar);
        }
	}
	printf("%lld\n", dp[0][0]);
	fflush(stdout);
	return 0;
}