#include <bits/stdc++.h>
using namespace std;
int main()
{   
    long long n;
    cin>>n;
    long long a[n] , b[n] , ans=0,cans=0,final=0,x=0,y=0,add=0,remove=0;
    for (long long i=0 ;i<n;i++)
    {
        cin>>a[i];
    }
    for (long long i=0 ;i<n;i++)
    {
        cin>>b[i];
    }
    for (long long i=0 ;i<n;i++)
    {
        ans=ans+(a[i]*b[i]);
    }
    final=ans;
    for (long long i=0 ;i<n;i++)
    {   
        cans=ans;
        x=i-1;
        y=i+1;
        while (x>=0 and y<n)
        {
            add=(a[x]*b[y])+(b[x]*a[y]);
            remove=(a[x]*b[x])+(b[y]*a[y]);
            cans=cans+add-remove;
            final=max(final,cans);
            x--;
            y++;
        }

        cans=ans;
        x=i;
        y=i+1;
        while (x>=0 and y<n)
        {
            add=(a[x]*b[y])+(b[x]*a[y]);
            remove=(a[x]*b[x])+(b[y]*a[y]);
            cans=cans+add-remove;
            final=max(final,cans);
            x--;
            y++;
        }
    }
    cout<<final<<"\n";
    return 0;
}