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 <climits>
#include <cstdio>
#include <cmath>
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define MAX 200'005
#define EPS 1e-6

double v[MAX];
int n;
double k;

double max_sum1(int l, int r){
    if(l > r)
        return 0;
    if(l == r)
        return max(v[l]-k,0.0);
    int m = (l+r)/2;
    double maxesq = max_sum1(l,m);
    double maxdir = max_sum1(m+1,r);
    double sumleft, sumright, maxleft, maxright;
    sumleft = sumright = maxleft = maxright = 0;

    for(int i = m; i >= l; i--){
        sumleft += v[i] - k;
        maxleft = max(maxleft,sumleft);
    }

    for(int i = m + 1; i <= r; i++){
        sumright += v[i] - k;
        maxright = max(maxright, sumright);
    }
    return max(max(maxright + maxleft, maxesq), maxdir);
}

double max_sum2(int l, int r){
    if(l > r)
        return 0;
    if(l == r)
        return max(k-v[l],0.0);
    int m = (l+r)/2;
    double maxesq = max_sum2(l,m);
    double maxdir = max_sum2(m+1,r);
    double sumleft, sumright, maxleft, maxright;
    sumleft = sumright = maxleft = maxright = 0;

    for(int i = m; i >= l; i--){
        sumleft += k - v[i];
        maxleft = max(maxleft,sumleft);
    }

    for(int i = m + 1; i <= r; i++){
        sumright += k - v[i];
        maxright = max(maxright, sumright);
    }
    return max(max(maxright + maxleft, maxesq), maxdir);
}


int main(){
    int i;
    double mini=INT_MAX,maxi=INT_MIN;
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%lf",&v[i]);
        maxi = max(maxi,v[i]);
        mini = min(mini,v[i]);
    }
    double l, r;
    maxi = max(abs(maxi),abs(mini));
    l = -maxi;
    r = maxi;
    double m1,m2,f1=0,f2=1;
    if(l!=r){
        while(r - l > EPS){
            m1 = l + (r-l)/3;
            m2 = r - (r-l)/3;
            k = m1;
            f1 = max(max_sum1(0,n-1),max_sum2(0,n-1));
            k = m2;
            f2 = max(max_sum1(0,n-1),max_sum2(0,n-1));
            if(f1 < f2)
                r = m2;
            else
                l = m1;
        }
    }
    printf("%.7lf\n",f1);
    //}else
        //cout << "0.00000000" <<endl;

    return 0;
}