#pragma GCC target ("popcnt,bmi2,avx512f,avx512dq,avx512cd,avx512bw,avx512vl")



#include <stdio.h>
#include <bits/stdc++.h>

int main()
{
	int i, N, A[2][100001];
	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][100001];
	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;
		for (j = 2 - l; j <= k; j += 2) {
			dp[0][j] = dp[0][j-1] + A[r][i];
			if (dp[0][j] < dp[0][j+1] + A[l][i]) dp[0][j] = dp[0][j+1] + A[l][i];
			dp[1][j] = dp[1][j-1] + A[l][i];
			if (dp[1][j] < dp[1][j+1] + A[r][i]) dp[1][j] = dp[1][j+1] + A[r][i];
		}
	}
	printf("%lld\n", dp[0][0]);
	fflush(stdout);
	return 0;
}

/*
　　　　　／＞　 フ
　　　　　| 　_　 _|
　 　　　／`ミ _x 彡
　　 　 /　　　 　 |
　　　 /　  ヽ　　 ?
　／￣|　　 |　|　|
　| (￣ヽ＿_ヽ_)_)
　＼二つ
 */

#include <queue>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MP make_pair
#define ll long long
#define fi first
#define se second
using namespace std;

template <typename T>
void read(T &x) {
    x = 0; bool f = 0;
    char c = getchar();
    for (;!isdigit(c);c=getchar()) if (c=='-') f=1;
    for (;isdigit(c);c=getchar()) x=x*10+(c^48);
    if (f) x=-x;
}

template<typename F>
inline void write(F x, char ed = '\n') {
	static short st[30];short tp=0;
	if(x<0) putchar('-'),x=-x;
	do st[++tp]=x%10,x/=10; while(x);
	while(tp) putchar('0'|st[tp--]);
	putchar(ed);
}

template <typename T>
inline void Mx(T &x, T y) { x < y && (x = y); }

template <typename T>
inline void Mn(T &x, T y) { x > y && (x = y); }

const int N = 505050;
int A[N], B[N], n;
ll ans;
priority_queue<int> q[2];
int main() {
	read(n);
	for (int i = 1;i <= n; i++) read(A[i]), ans += A[i];
	for (int i = 1;i <= n; i++) read(B[i]), B[i] -= A[i], q[i & 1].push(B[i]);
	while (q[0].size()) {
		ll x = q[0].top(), y = q[1].top();
		q[0].pop(), q[1].pop();
		if (x + y > 0) ans += x + y;
		else break;
	}
	write(ans);
	return 0;
}