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 Max = 2e5 + 100;
double data[Max], dp[Max];
double solve(double x, int n) {
  for (int i = 1; i <= n; i++) data[i] += x;
  for (int i = 1; i <= n; i++) data[i] = -data[i];
  dp[0] = 0;
  double mx = 0;
  for (int i = 1; i <= n; i++) {
    if (dp[i - 1] + data[i] > data[i])
      dp[i] = data[i] + dp[i - 1];
    else
      dp[i] = data[i];
    mx = max(dp[i], mx);
  }
  for (int i = 1; i <= n; i++) data[i] = -data[i];
  for (int i = 1; i <= n; i++) {
    if (dp[i - 1] + data[i] > data[i])
      dp[i] = data[i] + dp[i - 1];
    else
      dp[i] = data[i];
    mx = max(dp[i], mx);
  }
  for (int i = 1; i <= n; i++) data[i] -= x;
  return mx;
}
int main() {
  int n, ms = 0;
  double sum = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lf", &data[i]);
    sum += data[i];
    ms = max(ms, abs((int)data[i]));
  }
  double x = floor(sum / n);
  double mx = solve(-x, n);
  int xs = (int)1e8 / n / ms;
  double add = (double)1 / xs;
  double tmp = x - add;
  for (int i = 0;; i++, tmp -= add) {
    double l = solve(-tmp, n);
    if (l < mx)
      mx = l;
    else
      break;
  }
  tmp = x + add;
  for (int i = 0;; i++, tmp += add) {
    double l = solve(-tmp, n);
    if (l < mx)
      mx = l;
    else
      break;
  }
  printf("%.10f\n", mx);
  return 0;
}
