#include <bits/stdc++.h>
#include<sstream>
#include<string>
#include<vector>
#include <set>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define ll long long
#define ff first
#define ss second
#define decimal(ans,w) cout<<fixed<<setprecision(w)<<ans
long long M1=1000000007;
using namespace std;
ll fact[10000];
ll power(ll x, unsigned ll y, unsigned ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y / 2, m) % m; 
    p = (p * p) % m; 
  
    return (y % 2 == 0) ? p : (x * p) % m; 
} 
unsigned long long modInverse(unsigned long long n,  
                                            ll p)
{
    return power(n, p - 2, p);
}
unsigned long long nCrModPFermat(unsigned long long n,
                                 ll r, ll p)
{
    // If n<r, then nCr should return 0
    if (n < r)
        return 0;
    // Base case
    if (r == 0)
        return 1;
    return (fact[n] * modInverse(fact[r], p) % p
            * modInverse(fact[n - r], p) % p)
           % p;
}
int32_t main()
{
  IOS
  ll n,ma=0;
  cin>>n;
  ll a[n],b[n],sum=0;
  for(ll i=0;i<n;i++){
      cin>>a[i];
  }
  for(ll i=0;i<n;i++){
      cin>>b[i];
      sum+=a[i]*b[i];
  }
  for(ll i=0;i<n;i++)
  {
      ll l=i,r=i,cnt=0;
      while(l>=0 && r<n)
      {
          cnt+=(a[l]*b[r]+a[r]*b[l]-a[l]*b[l]-a[r]*b[r]);
          ma=max(ma,cnt);
          l--;
          r++;
      }
  }
  for(ll i=0;i<n;i++)
  {
     ll l=i,r=i+1,cnt=0;
      while(l>=0 && r<n)
      {
          cnt+=(a[l]*b[r]+a[r]*b[l]-a[l]*b[l]-a[r]*b[r]);
          ma=max(ma,cnt);
          l--;
          r++;
      } 
  }
  cout<<sum+ma;
  return 0;
}