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

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Scanner;

public class C {

    static void solve() throws IOException {
        int n = nextInt();
        int[] a = new int[n];
        double r = Integer.MIN_VALUE;
        double l = Integer.MAX_VALUE;
        for ( int i = 0; i < n; i ++ ) {
            a[i] = nextInt();
            r = Math.max( r, a[i] );
            l = Math.min( l, a[i] );
        }
        while ( r - l > 1e-7 ) {
            double m1 = ( l * 2 + r ) / 3;
            double m2 = ( l + r * 2 ) / 3;
            double p1 = poor( a, m1 );
            double p2 = poor( a, m2 );
            if ( p1 < p2 ) {
                r = m2;
            } else {
                l = m1;
            }
        }
        out.println( poor( a, ( l + r ) / 2 ) );
    }

    private static double poor( int[] a, double x ) {
        double maxp = 0.0;
        double maxm = 0.0;
        int lastp = 0;
        int lpl = 0;
        int lastm = 0;
        int lml = 0;
        boolean plus = true;
        for ( int aa : a ) {
            double v = aa - x;
            if ( plus ) {
                if ( v > 0 ) {
                    lastp += aa;
                    lpl ++;
                    maxp = Math.max( maxp, lastp - x * lpl );
                } else {
                    if ( lastm > lastp ) {
                        lastm -= lastp;
                        lml += lpl;
                    } else {
                        lastm = 0;
                    }
                    lastm -= aa;
                    lml ++;
                    maxm = Math.max( maxm, lastm + x * lml );
                    plus = false;
                }
            } else {
                if ( v > 0 ) {
                    if ( lastp > lastm ) {
                        lastp -= lastm;
                        lpl += lml;
                    } else {
                        lastp = 0;
                    }
                    lastp += aa;
                    lpl ++;
                    maxp = Math.max( maxp, lastp - x * lpl );
                    plus = true;
                } else {
                    lastm -= v;
                    lml ++;
                    maxm = Math.max( maxm, lastm + x * lml );
                }
            }
        }
        return Math.max( maxm, maxp );
    }

    static StreamTokenizer in;
    static PrintWriter out;

    static int nextInt() throws IOException {
        in.nextToken();
        return ( int ) in.nval;
    }

    public static void main( String[] args ) throws IOException {
        in = new StreamTokenizer( new InputStreamReader( System.in ) );
        out = new PrintWriter( System.out );
        solve();
        out.close();
    }
}
