#include<bits/stdc++.h>
#define ll long long
#define ljc 998244353
#define bit __builtin_popcount
using namespace std;
#define gc getchar
inline ll read(){
    register ll x=0,f=1;char ch=gc();
    while (!isdigit(ch)){if (ch=='-') f=-1;ch=gc();}
    while (isdigit(ch)){x=(x<<3)+(x<<1)+ch-'0';ch=gc();}
    return (f==1)?x:-x;
}
inline void file(){
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
}
int n;
ll A[1010101],B[1010101],sumB[1010101];
ll f[1010101][2],g[2][2];
priority_queue<ll> q[2];
signed main(){
	n=read();
	for (int i=1;i<=n;i++){
		A[i]=read();
	}
	ll _=0,ans=0;
	for (int i=1;i<=n;i++){
		B[i]=read();
		q[i%2].push(B[i]-A[i]);
		_+=A[i];
//		sumB[i]=sumB[i-1]+B[i];
	}
	ans=_;
	for (int i=1;i<=n/2;i++){
		_+=q[0].top(),_+=q[1].top();
		ans=max(ans,_);
		q[0].pop(),q[1].pop();
	}
	cout<<ans;
//	g[1][0]=0;
//	g[1][1]=-1e16;
//	g[0][1]=-1e16;
//	g[0][0]=0;
//	for (int i=1;i<=n;i++){
//		//(..) i-j=odd ok
//		f[i][0]=sumB[i-1]+g[1^(i&1)][1]+A[i];
//		g[i&1][0]=max(g[i&1][0],f[i][0]-sumB[i]);
//		f[i][1]=sumB[i-1]+g[1^(i&1)][0]+A[i];
//		g[i&1][1]=max(g[i&1][0],f[i][1]-sumB[i]);
//		ans=max(ans,f[i][0]+sumB[n]-sumB[i]);
//	}
//	cout<<ans;
	return 0;
}




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

//shorthands
#define ll                long long
#define ld                long double
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define mkp               make_pair
#define fastio            ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (ll)((x).size())
#define fr                first
#define sc                second
#define vll               vector <ll>
#define vpll              vector < pair<ll,ll> >
#define vect(a,n)         vll a(n); rep(i,0,n) cin>>a[i];
#define rep(i,a,b)        for(ll i = a; i < b; i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define PI                3.14159265358979323846


//Debug
#define printall(a) rep(i,0,a.size()) cout<<a[i]<<" "; cout<<"\n";

//Constants
const int mod = (int) 1e9 + 7 ;
const int INF = (int) 1e18 ;

//Input-Output File
void fileio(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin) ;
    freopen("output.txt", "w", stdout) ;
    #endif
}

ll modulo_binary_exp(ll a , ll b , ll m) {
    ll res = 1;
    while(b) {
        if(b % 2 == 0) {
            b = b/2;
            a = ((a % m)*(a % m)) % m;
        }
        else
        {
            b--;
            res = ((res % m)*(a % m)) % m;
        }
    }

    return res;
}

void solve() {
    ll a,b,c;
    cin >> a >> b >> c;
    ll p = modulo_binary_exp(b , c , 100);
    p += 100;
    ll q = modulo_binary_exp(a , p , 10);
    cout << q;
}

int main() {
    fastio;
    fileio;
    int t = 1; //cin >> t;
    while(t--) solve();
}



