#include <bits/stdc++.h> using namespace std; int main() { int n,height[10001];cin >> n; for(int i=1;i<=n;i++){cin >> height[i];}
int temp,re=0;
for(int i=1;i<=n;i++){
for(int j=i+1;j<=n;j++){
temp = (j-i)*min(height[i],height[j]);
if(temp > re){re = temp;cout << height[i] <<" "<< height[j] << " " << re<<endl;}
}
}
cout << re; }