/*
    _______                         _______                         _______
   / _____ \                       / _____ \                       / _____ \
  / /      \_\  _     __     _    / /      \ \   _     __     _   / /     \_\
 | |           | |   |  |   | |  | |        | | | |   |  |   | | | |
 | |           | |   |  |   | |  | |     __ | | | |   |  |   | | | |
 | |       __  \  \  |  |  /  /  | |     \ \| | \  \  |  |  /  / | |       __
  \ \_____/ /   \  \/ /\ \/  /    \ \_____\  /   \  \/   /\/  /   \ \_____/ /
   \_______/     \___/  \___/      \______/\__\   \___/  \___/     \_______/
*/
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cstring>
#include<queue>
using namespace std;

template <class T>
void Read(T &x)
{
	x = 0; int p = 0; char st = getchar();
	while (st < '0' || st > '9') p = (st == '-'), st = getchar();
	while (st >= '0' && st <= '9') x = (x << 1) + (x << 3) + st - '0', st = getchar();
	x = p ? -x : x;
	return;
}

template <class T>
void Print(T x)
{
	if (x > 9) Print(x / 10);
	putchar(x % 10 + '0');
	return;
}
const int N=5e5;
priority_queue<int>qod,qev;
int a[N],b[N],c[N],n;
int main()
{
	scanf("%d",&n);long long ans=0;
	for(int i=1;i<=n;i++)scanf("%d",a+i),ans+=a[i];
	for(int i=1;i<=n;i++)scanf("%d",b+i),c[i]=b[i]-a[i];
	long long s=ans;
	for(int i=1;i<=n;i+=2)qod.push(c[i]);
	for(int i=2;i<=n;i+=2)qev.push(c[i]);
	for(int i=1;i<=(n>>1);i++)
	{
		s+=qod.top()+qev.top();qod.pop(),qev.pop();
		ans=max(ans,s);	
	} 
	cout<<ans<<endl;
	return 0;
}

/*---------changeable---------*/
const int big=1000000007;
//const int big=998244353;
const double EPS=1e-8; //適宜変える
//#include <atcoder/all>
//using namespace atcoder;

#pragma region template
#ifdef LOGX
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;

/*---------macro---------*/
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define mybit(i,j) (((i)>>(j))&1)

/*---------type/const---------*/
typedef long long ll;
typedef unsigned long long ull;
typedef std::string::const_iterator state; //構文解析
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const char newl='\n';
struct{
    constexpr operator int(){return -int(1e9)-10;}
    constexpr operator ll(){return -ll(1e18)-10;}
}neginf;
struct{
    constexpr operator int(){return int(1e9)+10;}
    constexpr operator ll(){return ll(1e18)+10;}
    constexpr auto operator -(){return neginf;}
}inf;

/*---------debug---------*/
#ifdef LOGX
#include <template/debug.hpp>
#else
#define dbg(...) ;
#define dbgnewl ;
#define prt(x) ;
#define _prt(x) ;
#endif

/*---------function---------*/
template<typename T> T max(const std::vector<T> &a){T ans=a[0];for(T elem:a){ans=max(ans,elem);}return ans;}
template<typename T> T min(const std::vector<T> &a){T ans=a[0];for(T elem:a){ans=min(ans,elem);}return ans;}
template<typename T,typename U> bool chmin(T &a,const U b){if(a>b){a=b;return true;}return false;}
template<typename T,typename U> bool chmax(T &a,const U b){if(a<b){a=b;return true;}return false;}
bool valid(int i,int j,int h,int w){return (i>=0 && j>=0 && i<h && j<w);}
template<class T,class U>T expm(T x,U y,const ll mod=big){T res=1;while(y){if(y&1)(res*=x)%=mod;(x*=x)%=mod;y>>=1;}return res;}
template<class T,class U>T exp(T x,U y){T res=1;while(y){if(y&1)res*=x;x*=x;y>>=1;}return res;}
#pragma endregion template



int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.precision(10);
/*------------------------------------*/
    
    int n;
    cin >> n;
    vector<int> a(n),b(n);
    rep(i,n)cin >> a[i];
    rep(i,n)cin >> b[i];
    cout << max(0,min(b)-max(a)+1) << newl;
}