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).
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 26 08:46:00 2021

@author: yves
"""

n = input()

nombres = list(map(int, input().split()))

def plus_grande_sous_liste_n(li):
    meilleur = [None for i in li]
    somme = [None for i in li]
    best = None

    for i, el in enumerate(li):
        if el >= 0:
            if i > 0:
                somme[i] = max(somme[i-1], 0) + el
                meilleur[i] = meilleur[i-1] if somme[i-1] >= 0 else i
            else:
                somme[i] = el
                meilleur[i] = i
            if best is None or somme[i] > somme[best]:
                best = i
        else:
            somme[i] = (somme[i-1] + el) if i > 0 else el
            if somme[i] >= 0:
                meilleur[i] = meilleur[i-1]

    i, j = meilleur[best], best+1
    return sum(li [i:j])

def plus_petite_sous_liste_n(li):
    meilleur = [None for i in li]
    somme = [None for i in li]
    best = None

    for i, el in enumerate(li):
        if el <= 0:
            if i > 0:
                somme[i] = min(somme[i-1], 0) + el
                meilleur[i] = meilleur[i-1] if somme[i-1] <= 0 else i
            else:
                somme[i] = el
                meilleur[i] = i
            if best is None or somme[i] < somme[best]:
                best = i
        else:
            somme[i] = (somme[i-1] + el) if i > 0 else el
            if somme[i] <= 0:
                meilleur[i] = meilleur[i-1]

    i, j = meilleur[best], best+1
    return sum(li [i:j])

def pauvretes(li,x):
    liste = [elt - x for elt in li]
    return plus_grande_sous_liste_n(liste), plus_petite_sous_liste_n(liste)
 
def faiblesse(li, x):
    liste = [elt - x for elt in li]
    return max(abs(plus_grande_sous_liste_n(liste)), abs(plus_petite_sous_liste_n(liste)))


def dichotomie(a,b):
    if b - a < 10 ** (-6) / len(nombres):
        return (a+b) / 2
    milieu= (a+b) / 2
    maxi, mini = pauvretes(nombres, milieu)
    if maxi > -mini:
        return dichotomie(milieu, b)
    return dichotomie(a, milieu)
print(faiblesse(nombres, dichotomie(min(nombres), max(nombres))))