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).
# Tags: ternary search


def f(arr, x):
    new_arr = [num - x for num in arr]

    s = 0
    max_s = 0
    min_s = 0
    for num in new_arr:
        s += num
        max_s = max(max_s, s)
        min_s = min(min_s, s)

    return max_s - min_s


def find_max_weakness(arr, n):
    low = 0
    high = max(arr)

    while high - low >= 0.000001:
        m1 = low + (high - low) / 3
        m2 = high - (high - low) / 3

        f1 = f(arr, m1)
        f2 = f(arr, m2)
        if f1 < f2:
            high = m2
        else:
            low = m1

    return f(arr, low)


def main():
    n = int(input())

    arr = [int(val) for val in input().split()]

    print(find_max_weakness(arr, n))


main()
