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.BufferedReader;
import java.io.InputStreamReader;
public class weak {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static int n;
	public static void main(String[] args) throws Exception {
		n = Integer.parseInt(br.readLine());
		String[] line = br.readLine().split(" ");
		int nums[] = new int[n];
		int sums[] = new int[n+1];
		double x = 0;
		for(int j = 0; j < n; j++){
			nums[j] = Integer.parseInt(line[j]);
			x += nums[j];
			sums[j+1] = sums[j]+nums[j];
		}
		x = x/n;
		double numsx[] = new double[n];
		double nums_x[] = new double[n];
		for(int j = 0; j < n; j++){
			numsx[j] = nums[j] - x;
			nums_x[j] = x - nums[j];
		}
		double max = Math.max(maxSequenceSum(numsx), maxSequenceSum(nums_x));
		System.out.println(max);
	}
	public static double maxSequenceSum(double[] arr) {        
        double maxSoFar = arr[0], maxEndingHere = arr[0];
        for (int i = 1; i < arr.length; i++)
        {
            /* calculate maxEndingHere */
            if (maxEndingHere < 0)
                maxEndingHere = arr[i];
            else
                maxEndingHere += arr[i];
 
            /* calculate maxSoFar */
            if (maxEndingHere >= maxSoFar)
                maxSoFar = maxEndingHere;
        }
        return maxSoFar;
    } 

}
