#include <bits/stdc++.h>


using namespace std;

const int N = 1e4 +13;

long long A[N], L[N], R[N];

int n;
double x;




int main(){
    
    cin >> n;

    A[0] = 0; A[n+1] = 0;
    for (int i = 1; i<= n; i++){
        cin >> A[i];
    }

    R[1] = 0;
    for (int i = 2; i<= n; i++){
        
        if (A[i-1] == A[i]){
            R[i] = R[i-1];
            continue;
        }

        if (A[i] > A[i-1]){
            R[i] = i-1;
            continue;
        }

        int tmp = A[i-1];
        int idx = i - 1;
        while (tmp >= A[i])
        {   
            idx = R[idx];
            tmp = A[idx];
            
        }
        R[i] = idx;
    }


    L[n] = n+1;

    for (int i = n-1; i>= 1; i--){
        
        //cout << "i " << i << endl;
        if (A[i] == A[i +1]){
            L[i] = L[i+1];
            continue;
        }

        if (A[i] > A[i+1]){
            L[i] = i+1;
            continue;
        }

        int tmp = A[i+1];

        //cout << "tmp "<< tmp << endl;

        int idx = i + 1;
        while (tmp >= A[i])
        {   
            idx = L[idx];
            tmp = A[idx];
            
            //cout <<"tmp "<< tmp << "idx " << idx << endl;
        }
        
        L[i] = idx;
    }

    long long maximo = 0;
    for (int i = 1; i<= n; i++){
        int l = L[i];
        int r = R[i];

        //cout << "l "<< l << " r "<< r << endl;
        long long suma = (l - r - 1)*A[i];

        if (suma > maximo ){
            maximo = suma;
        }

    }

    cout << maximo;



/*
    cout << "R ";
    for (int i = 1; i<= n; i++){
        cout << R[i] << " ";
    }
    cout << "L ";
    for (int i = 1; i<= n; i++){
        cout << L[i] << " ";
    }
*/

    
    


    return 0;
}
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main(void){
  long long int n=0,x=0,man=0,che=0;
	long double euc=0.0;
  cin >> n;
  for (int i=0;i<n;i++){
    cin >> x;
    if(x<0)
			x *= -1;
    man += x;
    euc += x*x;
    if(x>che) che = x;
  }
  euc = sqrt(euc);
  cout << man << endl;
  cout << fixed << setprecision(15) << euc << endl;
  cout << che << endl;
  return 0;
}
