#include<bits/stdc++.h>
#define ll long long
#define MAX 1000006
using namespace std;
int main()
{


    ll t;
     ll n,m,x,a,b,c,flag=0;





    //vector<ll>v(n+5);

    vector<pair<int,int>>vp;
    vector<ll>v;
    vector<ll>v1;

    map<ll ,vector<ll>>mpp;

    set<ll>se;


    string s,s1,s2;

    ll ans=0,ans1=0,ans2=0,temp=0;

    double m1;


  cin>>n;

  for(ll i=0;i<n;i++)
  {
      cin>>a;
      v.push_back(a);
  }

   for(ll i=0;i<n;i++)
  {
      ll minn=INT_MAX;
       for(ll j=i;j<n;j++)
          {

              minn= min(v[j],minn);

                  ans=minn*(j-i+1);


              ans1=max(ans1,ans);
          }
  }

  cout<<ans1<<endl;













    return 0;


}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
#define fi first
#define se second
#define endl '\n'
#define y1 holyshit
#define all(x) x.begin(),x.end()
const int inf=0x3f3f3f3f;

int N;
ll A[100010],B[100010];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin>>N;
	for(int i=0;i<N;i++) cin>>A[i];
	for(int i=0;i<N;i++) cin>>B[i];
	ll ans=0;
	for(int i=0;i<N;i++) ans+=A[i]*B[i];
	if(ans) cout<<"No";
	else cout<<"Yes";
	return 0;
}