#include<bits/stdc++.h>usingnamespacestd;typedefcomplex<double>cpx;typedefvector<cpx>vec;constdoublepi=acos(-1);/*
input : f => Coefficient, w => principal n-th root of unity
output : f => f(x_0), f(x_1), f(x_2), ... , f(x_n-1)
T(N) = 2T(N/2) + O(N)
*/voidFFT(vec&f,cpxw){intn=f.size();if(n==1)return;//base caseveceven(n>>1),odd(n>>1);for(inti=0;i<n;i++){if(i&1)odd[i>>1]=f[i];elseeven[i>>1]=f[i];}FFT(even,w*w);FFT(odd,w*w);cpxwp(1,0);for(inti=0;i<n/2;i++){f[i]=even[i]+wp*odd[i];f[i+n/2]=even[i]-wp*odd[i];wp*=w;}}/*
input : a => A's Coefficient, b => B's Coefficient
output : A * B
*/vecmul(veca,vecb){intn=1;while(n<=a.size()||n<=b.size())n<<=1;n<<=1;a.resize(n);b.resize(n);vecc(n);cpxw(cos(2*pi/n),sin(2*pi/n));FFT(a,w);FFT(b,w);for(inti=0;i<n;i++)c[i]=a[i]*b[i];FFT(c,cpx(1,0)/w);for(inti=0;i<n;i++){c[i]/=cpx(n,0);c[i]=cpx(round(c[i].real()),round(c[i].imag()));//result is integer}returnc;}intmain(){ios_base::sync_with_stdio(0);cin.tie(0);intn;cin>>n;vector<int>A(n+n),B(n);for(inti=0;i<n;i++)cin>>A[i];for(inti=n-1;i>=0;i--)cin>>B[i];for(inti=0;i<n;i++)A[i+n]=A[i];veca,b;for(autoi:A)a.push_back(cpx(i,0));for(autoi:B)b.push_back(cpx(i,0));vecc=mul(a,b);longlongans=0;for(inti=0;i<c.size();i++){ans=max<longlong>(ans,round(c[i].real()));}cout<<ans;}