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).
from sys import stdin as input

def weaknessPoorness():
    n = int(input.readline())
    nums = list(map(int, input.readline().split()))

    lo = (-1)*10^4
    hi = 10^4
    ans = float('inf')
    for _ in range(100):
        x = (lo + hi) / 2
        min_over_seg, max_over_seg = float('inf'), float('-inf')
        min_sum, max_sum = 0, 0

        prefix = [0] * n
        prefix[0] = nums[0] - x
        for i in range(1, n):
            prefix[i] = prefix[i-1] + nums[i] - x

        for r in range(n):
            max_over_seg = max(prefix[r] - min_sum, max_over_seg)
            min_over_seg = min(prefix[r] - max_sum, min_over_seg)

            max_sum = max(max_sum, prefix[r])
            min_sum = min(min_sum, prefix[r])

        ans = min(ans, max(abs(min_over_seg), abs(max_over_seg)))
        if abs(min_over_seg) > abs(max_over_seg):
            hi = x
        else:
            lo = x

    print(ans)

weaknessPoorness()