/*
 * @Author: zhl
 * @Date: 2020-10-18 20:56:45
 */
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int A[N], B[N], n;

int ans;
void dfs(int now, stack<int> s, int sum) {
	if (now == n) {
		if (s.empty()) {
			ans = max(ans, sum);
			return;
		}
	}
	if (!s.empty()) {
		int tp = s.top();
		int d = max(A[tp] + A[now + 1], B[tp] + B[now + 1]);
		s.pop();
		dfs(now + 1, s, sum + d);
		s.push(tp);
	}
	if (n - now >= s.size()) {
		s.push(now + 1);
		dfs(now + 1, s, sum);
	}
}
int main() {
	cin >> n;
	long long 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];

	vector<int>a, b;
	for (int i = 1; i <= n; i++) {
		if (i & 1)a.push_back(B[i]);
		else b.push_back(B[i]);
	}
	sort(a.begin(), a.end(), greater<int>());
	sort(b.begin(), b.end(), greater<int>());

	for (int i = 1; i <= n / 2; i++) {
		if (a[i - 1] + b[i - 1] > 0) {
			ans += a[i - 1] + b[i - 1];
		}
	}
	cout << ans << endl;

}

#include <bits/stdc++.h>

#define ll long long
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define pii pair<int, int>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
using namespace std;
template<typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    ll cost = 0;
    rep(i, 0, n) {
        cin >> a[i];
        cost += a[i];
    }
    vector<ll> ve[2];
    rep(i, 0, n) {
        cin >> b[i];
        ve[i % 2].push_back(b[i] - a[i]);
    }
    sort(all(ve[0]), greater<>());
    sort(all(ve[1]), greater<>());
    int idx = 0;
    while(idx < n / 2 && ve[0][idx] + ve[1][idx] > 0) {
        cost += ve[0][idx] + ve[1][idx];
        idx++;
    }
    cout << cost << '\n';
}