10
-405 -230 252 -393 -390 -259 97 163 81 -129
 3
10000 -10000 10000
 1
-10000
 20
-16 -23 29 44 -40 -50 -41 34 -38 30 -12 28 -44 -49 15 50 -28 38 -2 0

702.333333333333712
 10000.000000000016371
 0.000000000000000
 113.875000000000043

#include <iostream>
using namespace std;

int main()
{
    /*
    int a, b;
    cin >> a >> b;
    if (a < b) cout << -1;
    else
    {
        if ((a + b) % 2 == 0)
            printf("%0.12lf", (double)b);
        else
        {
            printf("%0.12lf", (double)b / a + b);
        }
    }

    return 0;

    */
    int n;
    double  res = 0;
    __int64 a = 0;
    cin >> n;
    double max = 0, min = 0;
    double maxN = 0, minN = 0;
    
    double * mas = new double[n];
    for (int i = 0; i < n; i++)
    {
        cin >> mas[i];
        if (max < mas[i]) max = mas[i];
        if (min > mas[i]) min = mas[i];
        a += mas[i];
    }

    double x = (double)a / n;
    if (max > 0 && min < 0)
    {
        min *= -1;
        if (max > min && x > (max - min))   printf("%.7lf", max); //x = max - min;
        else 
        if (x > (min - max))    printf("%.7lf", min);// x = min - max;

    }
     max = 0, min = 0;
     maxN = 0, minN = 0;
    for (int i = 0; i < n; i++)
    {
        minN += mas[i] - x;
        maxN += mas[i] - x;

        if (minN > 0) minN = 0;
        if (maxN < 0) maxN = 0;
        if (min > minN) min = minN;
        if (max < maxN) max = maxN;
    }
    min *= -1;
    if (min > max) max = min;
    printf("%.7lf", max);
    return 0;
}