You are given a sequence of n integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub>. 

Determine a real number *x* such that the weakness of the sequence *a*<sub class="lower-index">1</sub> - *x*, *a*<sub class="lower-index">2</sub> - *x*, ..., *a*<sub class="lower-index">*n*</sub> - *x* is as small as possible.

The weakness of a sequence is defined as the maximum value of the poorness over all segments (contiguous subsequences) of a sequence.

The poorness of a segment is defined as the absolute value of sum of the elements of segment.
The first line contains one integer *n* (1 ≤ *n* ≤ 200 000), the length of a sequence.

The second line contains *n* integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (|*a*<sub class="lower-index">*i*</sub>| ≤ 10 000).
#include<bits/stdc++.h>
using namespace std;
double a[200009];
double ans;double n;
double check(double ans)
{
	double tmp=0,ans1=0;
	for(int i=1;i<=n;i++)a[i]-=ans;
	for(int i=1;i<=n;i++)
	{
		tmp+=a[i];
		if(tmp>0) tmp=0;
		ans1=max(ans1,-tmp); 
	 } 
	 tmp=0;
	 for(int i=1;i<=n;i++)
	{
		tmp+=a[i];
		if(tmp<0) tmp=0;
		ans1=max(ans1,tmp); 
	 } 
	 for(int i=1;i<=n;i++)a[i]+=ans;
	 return ans1;
} 
int main()
{
	//freopen("1.txt","r",stdin);
	cin>>n;
	double l=214748364,r=-214748364;
	for(int i=1;i<=n;i++) 
	{
		scanf("%lf",&a[i]);
		r=max(r,a[i]);
		r=max(r,-a[i]);
		l=min(l,a[i]);
		l=min(l,-a[i]);
	}
	double tot=2147483647;
	tot=min(check(l),check(r));
	int cnt=0; 
	while(cnt++<400)
	{
		double mid1=l+(r-l)/3.0,mid2=l+(r-l)/3.0*2.0;
		double a,b;
		b=check(mid1);
		a=check(mid2);
		if(b<a) r=mid2;
		if(b>=a) l=mid1; 
		tot=min(a,min(b,tot));
	}
	printf("%.6lf",tot);
 } 