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).
def costFunction(arr, val):
    tot = 0
    v1 = 0
    for i in range(len(arr)):
        tot += (arr[i] - val)
        if tot < 0:
            tot = 0
        v1 = max(v1, tot)
    tot = 0
    for i in range(len(arr)):
        tot += (val - arr[i])
        if tot < 0:
            tot = 0
        v1 = max(v1, tot)
    return v1

def minimumWeakness(arr):
    l, r = -100000, 100000
    while r - l > 0.000000000001:
        m1 = l + (r - l) / 3
        m2 = r - (r - l) / 3
        c1 = costFunction(arr, m1)
        c2 = costFunction(arr, m2)
        if c1 > c2:
            l = m1
        else:
            r = m2
    return min(costFunction(arr, l), costFunction(arr, r))

def main():
    n = int(input())
    arr = [int(a) for a in input().split()]
    print(minimumWeakness(arr))

if __name__ == "__main__":
    main()