#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> A(N);
    for (auto& a : A) {
        cin >> a;
    }
    ll ans = 0;
    rep(i, 0, N) {
        ll min_a = A[i];
        rep(j, i, N) {
            chmin(min_a, A[j]);
            chmax(ans, min_a * (ll)(j - i + 1));
        }
    }
    cout << ans << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

void printmat(const vector<vector<int>>& mat) {
    for (auto row : mat) {
        for (int elem : row)
            cout << elem << " ";
        cout << endl;
    }
}
void printv(const vector<long long>& v) {
    for (int elem : v)
        cout << elem << " ";
    cout << endl;
}
void printvp(const vector<pair<int, int>>& vp) {
    for (auto row : vp) 
        cout << row.first << ", " << row.second << " ; ";
    cout << endl;
}

int main() {
    int T=1, caseIdx=0;
    //cin >> T;  
    while (T--) {
        caseIdx++;
        string x, ans;
        cin >> x;
        auto it = x.find('.');
        ans = x.substr(0, it);
        
        cout << ans << endl;
        //cout << "Case #" << caseIdx << ": " << ans << endl;
    }
}