You are given two integer arrays a and b of length n.

You can reverse at most one subarray (continuous subsegment) of the array a. 

Your task is to reverse such a subarray that the sum ∑_{i=1}^n a_i ⋅ b_i is maximized.

Input

The first line contains one integer n (1 ≤ n ≤ 5000).

The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^7).

The third line contains n integers b_1, b_2, ..., b_n (1 ≤ b_i ≤ 10^7).

Output

Print single integer — maximum possible sum after reversing at most one subarray (continuous subsegment) of a.

Examples

Input


5
2 3 2 1 3
1 3 2 4 2


Output


29


Input


2
13 37
2 4


Output


174


Input


6
1 8 7 6 3 6
5 9 6 8 8 6


Output


235

Note

In the first example, you can reverse the subarray [4, 5]. Then a = [2, 3, 2, 3, 1] and 2 ⋅ 1 + 3 ⋅ 3 + 2 ⋅ 2 + 3 ⋅ 4 + 1 ⋅ 2 = 29.

In the second example, you don't need to use the reverse operation. 13 ⋅ 2 + 37 ⋅ 4 = 174.

In the third example, you can reverse the subarray [3, 5]. Then a = [1, 8, 3, 6, 7, 6] and 1 ⋅ 5 + 8 ⋅ 9 + 3 ⋅ 6 + 6 ⋅ 8 + 7 ⋅ 8 + 6 ⋅ 6 = 235.
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define INF             1e14
#define SINF            1e9
#define PI              3.14159265358979323846
#define dd              double
#define MOD             1000000007
typedef unsigned long long ull;
typedef pair<ll,ll> pii;
typedef vector<ll> vi;
typedef vector<pair<int,int>> vpi;
typedef vector<vector<ll>> vvi;



#define fill(a,val)     memset(a,val,sizeof(a))
#define mp(e1, e2)      make_pair(e1, e2)
#define pb(e)           push_back(e)
#define all(v)          v.begin(), v.end()
#define nl              cout<<endl

#define sortarray(ar,n)         sort(ar,ar+n)
#define reversesort(ar,n)       sort(ar, ar+n, greater<ll>())
#define sortvec(v)              sort(v.begin(), v.end())
#define revsortvec(v)           sort(v.begin(), v.end(), greater<ll>())

#define inp(n)          int n;cin>>n
#define aout(a,n)       for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define ain(a,n)        for(ll i=0;i<n;i++)cin>>a[i];
#define vin(v, n)       for(ll i=0;i<n;i++){ll x; cin>>x; v.pb(x);}
#define vout(v)         for(auto it:v){cout<<it<<" ";}nl;

#define revarr(a, n)    for(ll i=0;i<n/2;i++){ll temp = a[i];a[i]=a[n-i-1];a[n-i-1]=temp;}
#define max3(a, b, c)   a>b?(a>c?a:c):(b>c?b:c)
#define min3(a, b, c)   a<b?(a<c?a:c):(b<c?b:c)

#define o0(a) cout<<a<<" "
#define o1(a) cout<<a<<"\n"
#define o2(a, b) cout<<a<<" "<<b<<"\n"
#define o3(a, b, c) cout<<a<<" "<<b<<" "<<c<<"\n"
#define o4(a, b, c, d) cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n"
#define i1(a) cin>>a
#define i2(a, b) cin>>a>>b
#define i3(a, b, c) cin>>a>>b>>c
#define i4(a, b, c, d) cin>>a>>b>>c>>d
#define fi first
#define se second

#define fastio()        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define printclock      cerr<<"Time : "<<1000*(long double)clock()/(long double)CLOCKS_PER_SEC<<"ms\n";
#define fr(i,a,b)       for(ll i=a;i<b;i++)
#define frr(i,b,a)      for(ll i=b-1;i>=a;i--)
ll gcd(ll a, ll b){return b ? gcd (b, a % b) : a;}
ll power(ll x,ll y,ll p ){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
ll lcm(ll a , ll b){return (a/gcd(a, b))*b;}
ll searchll(ll val, vector<ll>&vec){fr(i, 0, vec.size()){if(vec[i]==val){return i;}}return -1;}
bool isnumber(string s){for(int i=0;i<s.size();i++){if(isdigit(s[i])==false)return false;return true;}}
bool isPrime(ll n){int broken=0;fr(i, 2, sqrt(n)+1){if(n%i==0){broken=1;break;}}if(broken==1){return false;}else{return true;}}
bool isPerfectSquare(long double x){long double sr = sqrt(x);return ((sr - floor(sr)) == 0);}
vector<bool> SieveOfEratosthenes(ll num) {      vector<bool>pno;pno.assign(num+1, true);pno[0]=false;pno[1]=false;for (ll i=2;i*i<=num;i++){if(pno[i]==true){for(ll j=i*2;j<=num;j+=i)pno[j]=false;}}return pno;}
vector<ll> SieveOfEratosthenesExtended(ll num) {vector<ll>pno(num+1);fr(i,0,num+1){pno[i]=i;}for(ll i=2;i*i<=num;i++){if(pno[i]==i){for(ll j=i*2;j<=num;j+=i)if(pno[j]==j)pno[j]=i;}}return pno;}
vector<ll> PrimeFactorize(ll num){vector<ll>spf;spf=SieveOfEratosthenesExtended(num);set<ll>pf;while(num!=1){pf.insert(spf[num]);num=num/spf[num];}vector<ll>v;for(auto it:pf){v.pb(it);}return v;}
ll stringToInt(string s){ll num=0;fr(i,0,s.length()){num=num*10+(s[i]-'0');}return num;}
ll BinarySearch(vector<ll>&arr, ll num){ll left=0, right=arr.size(), mid;while (left<right) {mid = (left+right)/2;if (arr[mid]==num) {return mid;}else if (arr[mid]<num){left = mid+1;}else{right = mid;}}return left;}
ll mod=1e9+7,f[200003];
ll inv(ll a)
{
  ll c=1,b=mod-2;
  while(b){if(b&1)c=c*a%mod;a=a*a%mod;b/=2;}
  return c;
}
ll ncr(ll n,ll r){return f[n]*inv(f[n-r])%mod*inv(f[r])%mod;}




void solve()
{









    //           START



    ll n;
    cin>>n;
    ll a[n],b[n];
    ll 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];
    }
    ll ans1=sum;
    for(ll i=0;i<n;i++)
    {
        ll l=i,r=i;
        ll ans2=ans1;
        while(l>=0&&r<n)
        {
            ans2-=a[l]*b[l]+a[r]*b[r];
            ans2+=a[l]*b[r]+a[r]*b[l];
            sum=max(ans2,sum);
            l--;
            r++;
        }
        ans2=ans1;
        l=i;
        r=i+1;
        while(l>=0&&r<n)
        {
            ans2-=a[l]*b[l]+a[r]*b[r];
            ans2+=a[l]*b[r]+a[r]*b[l];
            sum=max(ans2,sum);
            l--;
            r++;
        }
    }
    cout<<sum;

    //           END





















}


int main()
{

fastio();

 /* */#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    #endif
/* */


int t=1;
//cin>>t;
while(t--)
{
    solve();
}












/*

set<long long int> s;
int n;
cin>>n;
for(long long int i=1;i<n;i++)
{
    if(i*(i+1)/2> 1e9)
        break;
    s.insert((i*(i+1)/2));
}
for(auto it=s.begin();it!=s.end();it++)
{
    if((n-*it)>0 && s.count(n-*it))
    {
        cout<<"YES";
        return 0;
    }
}
cout<<"NO";

*/

/*

  int a,b,k;
		cin >> a >> b >> k;
		int aa[k], bb[k];
		map <int,int> ma,mb;
		pair <int,int> p[k];
		int x,y;
		for(int i=0; i<k; i++){
			cin >> aa[i];
			ma[aa[i]]++;
		}
		for(int i=0; i<k; i++){
			cin >> bb[i];
			mb[bb[i]]++;
			p[i] = {aa[i],bb[i]};
		}

		//sort(p, p+n);

		int ans=0;
		for(int i=0; i<k; i++){
			ans += k - ma[p[i].fi] - mb[p[i].se] + 1;
		}

		cout << ans/2 << "\n";


*/



/* ******************************************************************************************
   ****************GREEDY ALGO***************************************************************
   ***************************************************************************************************/


/*

    JUMP
    int jump(vector<int>& nums) {
        int n=nums.size();

        if(n==0||nums[0]==0)
            return 0;

        int currend=nums[0];
        int maxend=nums[0];
        int j=1;

        for(int i=1;i<n;i++)
        {
            if(i==n-1)
                return j;
            maxend=max(maxend,i+nums[i]);
            if(i==currend)
            {
                j++;
                currend=maxend;
            }
        }
        return j;
    }








*/




/*    map use;    */


/*

class Solution {
public:
    int minSwapsCouples(vector<int>& row) {
        int c=0;
        unordered_map<int,int> m;
        for(int i=0;i<row.size();i++)
            m[row[i]]=i;
        for(int i=0;i<row.size();i+=2)
        {
            int first=row[i];
            int second = first+(first%2==0?1:-1);
            if(row[i+1]!=second)
            {
                c++;
                int x=row[i+1];
                swap(row[i+1],row[m[second]]);
                m[x]=m[second];
                m[second]=i+1;
            }
        }
        return c;
    }
};

*/


















































#ifndef ONLINE_JUDGE
    printclock;
    #endif









	return 0;
}
