#include using namespace std; using ll = long long; using pll = pair; #define drep(i, cc, n) for (ll i = (cc); i <= (n); ++i) #define rep(i, n) drep(i, 0, n - 1) #define all(a) (a).begin(), (a).end() #define pb push_back #define fi first #define se second const ll MOD = 1000000007; const ll MOD2 = 998244353; const ll INF = 1LL << 60; const ll MAX_N = 2e5; ll n; vector a, b; ll solve(ll base){ vector c(n, 0); c[0] = base; for(ll i=1; i> n; a.resize(n); b.resize(n); rep(i, n) cin >> a[i]; rep(i, n) cin >> b[i]; ll ans = INF; ans = min(ans, solve(a[0])); ans = min(ans, solve(b[0])); ans = min(ans, solve((a[0]+b[0])/2)); cout << ans << endl; }