#include<bits/stdc++.h>
using  namespace std;
#define fast {ios_base::sync_with_stdio(false); cin.tie(0);}
typedef long long ll;
int main()
{
    fast
    ll i,j,k,n,m,c,t,ind1,ind2;
    cin>>n;
    ll a[n+4],b[n+4],ans=0;
    for(i=1;i<=n;i++) cin>>a[i];
    for(i=1;i<=n;i++){cin>>b[i];ans+=a[i]*b[i];}
    c=ans;k=ans;
    for(i=2;i<n;i++){
        ind1=i-1;ind2=i+1;c=k;
        while(ind1>=1&&ind2<=n){
            c+=a[ind1]*b[ind2]+a[ind2]*b[ind1]-a[ind1]*b[ind1]-a[ind2]*b[ind2];
            ans=max(ans,c);ind1--;ind2++;
        }
    }
    for(i=1;i<n;i++){
        ind1=i;ind2=i+1;c=k;
        while(ind1>=1&&ind2<=n){
             c+=a[ind1]*b[ind2]+a[ind2]*b[ind1]-a[ind1]*b[ind1]-a[ind2]*b[ind2];
            ans=max(ans,c);ind1--;ind2++;
        }
    } cout<<ans;
}
