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;
import java.util.Arrays;
public class Tester {

	public static void main(String[] args)throws Exception {
		BufferedReader scan = new BufferedReader (new InputStreamReader(System.in));
		int total=Integer.parseInt(scan.readLine());
		String[] new1=scan.readLine().split(" ");
		float[] series=new float[total];
		float sum=0;
		int s=0;
		for(int i=0;i<total;i++){
			series[i]=Integer.parseInt(new1[i]);
			if(series[i]<0){
				s++;
			}
			sum=sum+series[i];
		}
		if(s!=0){
			sum=0;
		}
		else{
		sum=sum/total;
		}
		for(int i=0;i<total;i++){
			series[i]=series[i]-sum;
		}
		float result=0;
		for(int i=0;i<total;i++){
			if(series[i]>0){
				float max=series[i];
				for(int j=i+1;j<total;j++){
					if(series[j]>0){
						max=max+series[j];
					}
					else{
						break;
					}
				}
				if(max>result){
					result=max;
				}
			}
			else if(series[i]<0){
				float max=series[i]*(-1);
				for(int j=i+1;j<total;j++){
					if(series[j]<0){
						max=max+series[j]*(-1);
					}
					else{
						break;
					}
				}
				if(max>result){
					result=max;
				}
			}
		}
		System.out.println(result);

	}

}
