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 <bits/stdc++.h>
#include <ext/numeric>
using namespace std;
using namespace __gnu_cxx;
#define oo 1<<30
#define OO 1LL<<60
#define sz(V)        ((int)((v).size()))
#define all(v)         v.begin(),v.end()
#define rall(v)         v.rbegin(),v.rend()

const int mod = 1e9 + 7;
const int N = 2e5 + 100;

int n;
long double sum, mid;
int arr[N];
long double arr1[N], arr2[N];
long double ans1, ans2, ans3;
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
//  freopen("o.txt", "wt", stdout);
#endif
    cin >> n;
    for (int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
        sum += arr[i];
    }
    mid = sum / n;
    for (int i = 0; i < n; i++) {
        arr1[i] = arr[i] - mid;
        arr2[i] = mid - arr[i];
    }
    ans1 = 0, ans2 = 0, sum = 0;
    for (int i = 0; i < n; i++) {
        sum += arr1[i];
        ans1 = max(ans1, sum);
        if (sum < 0)
            sum = 0;
    }
    sum = 0;
    for (int i = 0; i < n; i++) {
        sum += arr2[i];
        ans2 = max(ans2, sum);
        if (sum < 0)
            sum = 0;
    }
    ans3 = 0, sum = 0;
    for (int i = 0; i < n; i++) {
        sum += arr[i];
        ans3 = max(ans3, sum);
        if (sum < 0)
            sum = 0;
    }
    cout << fixed << setprecision(12) << min(ans3, max(ans1, ans2));
}
