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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define rep(i,a,b) for(ll i=a;i<=b;++i)
#define rrep(i,a,b) for(ll i=a;i>=b;--i)
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define PI 3.14159265358979323846
#define fi first
#define se second
#define all(x)  x.begin(),x.end()
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

const ll mod = 1e9+7;
const ll INF = 1e18;
const ll MAXN = 40;

ll poww(ll a, ll b) {    
    if(b<0) return 0LL;
    ll ans = 1;
    while (b) {
        if (b & 1)ans = ans * a;
        a = a * a;
        b >>= 1;
    }   
    return ans;
}
ll binpow(ll a, ll b)
{
    if (b < 0) return 0LL;
    if (a <= 0)return 0LL;
    a %= mod;
    
    ll ans = 1LL;
    while (b) {
        if (b & 1)ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ans;
}
ll modinv(ll n) {
    return binpow(n, mod - 2);
}

ll spf[MAXN];   
void sieve() 
{ 
    spf[1] = 1; 
    for (ll i=2; i<MAXN; i++) spf[i] = i; 
    for (ll i=4; i<MAXN; i+=2) spf[i] = 2; 
  
    for (ll i=3; i*i<MAXN; i++) { 
        if (spf[i] == i) {
            for (ll j=i*i; j<MAXN; j+=i) { 
                if (spf[j]==j) spf[j] = i;
            }        
        } 
    } 
}

vector<ll> getFactorization(ll x) 
{ 
    vector<ll> ret; 
    while (x != 1) 
    { 
        ret.push_back(spf[x]); 
        x = x / spf[x]; 
    } 
    return ret; 
} 

void solve() {
    ll n; cin>>n;
    ll ans = 1;
    map<ll,ll> mt;
    sieve();
    for(ll i =2; i<=n; i++) {
        map<ll,ll> temp;
        vector<ll> v = getFactorization(i);
        for(ll x : v) {
            temp[x]++;
        }
        for(auto it = temp.begin(); it!=temp.end(); it++) {
            mt[it->fi] = max(mt[it->fi],it->se);
        }
    }   

    for(auto it = mt.begin(); it!=mt.end(); it++) {
        ans *= poww(it->fi,it->se);    
    }
    ans++;
    cout<<ans;
}

int main() {
    IOS; 
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    
    //ll no_of_test_cases; cin>>no_of_test_cases; 
    ll no_of_test_cases = 1;
    for(ll i=1; i<=no_of_test_cases; i++) {
        solve();
    } 
    return 0; 
}

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

using Int = long long;
const char newl = '\n';

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}
template<typename T=Int>
vector<T> read(size_t n){
  vector<T> ts(n);
  for(size_t i=0;i<n;i++) cin>>ts[i];
  return ts;
}

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  Int n;
  cin>>n;
  auto as=read(n);
  auto bs=read(n);

  Int ans=0;
  for(Int a:as) ans+=a;

  priority_queue<Int> pq[2];
  for(Int i=0;i<n;i++)
    pq[i&1].emplace(bs[i]-as[i]);

  while(!pq[0].empty()){
    Int res=pq[0].top()+pq[1].top();
    pq[0].pop();pq[1].pop();
    if(res>0) ans+=res;
    else break;
  }

  cout<<ans<<newl;
  return 0;
}
