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>
using namespace std;
const int INF = 0x7fffffff;
inline int reint() {
  int d;
  scanf("%d", &d);
  return d;
}
inline long relong() {
  long l;
  scanf("%ld", &l);
  return l;
}
inline char rechar() {
  scanf(" ");
  return getchar();
}
inline double redouble() {
  double d;
  scanf("%lf", &d);
  return d;
}
inline string restring() {
  string s;
  cin >> s;
  return s;
}
const int maxn = 2e5 + 10;
int n;
int a[maxn];
double b[maxn];
int main(void) {
  cin >> n;
  long long sum = 0;
  long long amax = 0;
  long long amin = INF;
  for (int i = (0); i < (n); i++) {
    cin >> a[i];
    if (a[i] > amax) {
      amax = a[i];
    }
    if (a[i] < amin) {
      amin = a[i];
    }
    sum += a[i];
  }
  double ave = (amin + amax) / 2.0;
  double ans = 0;
  for (int i = (0); i < (n); i++) {
    b[i] = a[i] - ave;
  }
  double cursum = 0;
  double curmax = 0;
  for (int i = (0); i < (n); i++) {
    cursum += b[i];
    if (cursum > curmax) curmax = cursum;
    if (cursum < 0) {
      cursum = 0;
    }
  }
  printf("%.12f\n", curmax);
  return 0;
}
