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;
int n;
double a[200000 + 10], ans = -0x7fffffff;
double ag;
void Read(int &x) {
  char c;
  while (c = getchar(), c != EOF)
    if (c >= '0' && c <= '9') {
      x = c - '0';
      while (c = getchar(), c >= '0' && c <= '9') x = x * 10 + c - '0';
      ungetc(c, stdin);
      return;
    }
}
int main() {
  Read(n);
  int i;
  for (i = 1; i <= n; i++) {
    scanf("%lf", &a[i]);
    ag += a[i];
  }
  ag /= n;
  for (i = 1; i <= n; i++) {
    a[i] -= ag;
    a[i] = a[i - 1] > 0 ? a[i] + a[i - 1] : a[i];
    ans = max(ans, a[i]);
  }
  printf("%.15lf\n", ans);
}
