#include using namespace std; #define FOR(i, x, y) for(ll i = (x); i <= (y); ++i) #define bug(a) cout << #a << " = " << a << endl; #define fbug(a, x, y) { cout << #a << ": "; FOR(i, x, y) cout << a[i] << ' '; cout << endl; } #define pb push_back #define mp make_pair #define endd "\n" #define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define input freopen("inp.txt","r",stdin) #define output freopen("out1.txt","w",stdout) #define loop(i,n) for(ll i=0;i=0;i--) #define ll long long #define Z size() #define pii pair #define pll pair #define setp(x) fixed<> t; while(t--) #define ff first #define ss second #define all(x) x.begin(),x.end() #define pi 3.14159265358979323846264338327950288419716939937510 #define mset(x) memset(x,0,sizeof x); #define mset_(x,y) memset(x,y,sizeof x); #define spa cout<>n; ll a[n+1]; ll b[n+1]; ll c[n+1]; a[0]=b[0]=c[0]=0; FOR(i,1,n) { cin>>a[i]; { b[i]=b[i-1]+a[i]; c[i]=c[i-1]+(a[i]*a[i]); } } ll ans=0; FOR(i,1,n-1) { FOR(j,i,n-1) { ans=max(ans,((b[j]-b[i-1])*(b[j]-b[i-1])-(c[j]-c[i-1]))/2); } } cout<