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

def cal(x, li, sign):
    sum = 0
    ans = 0
    for i in range(0,n):
        sum += (li[i]-x)*sign
        if sum < 0:
            sum = 0
        if sum > ans:
            ans = sum
    return ans

n = int(input())
li = [int(x) for x in input().split()]

l = sorted(li)
r = l[n-1]
l = l[0]

ans = -1
min = 99999999

while True:
    k = (r+l)/2
    a1 = cal(k, li, 1)
    a2 = cal(k, li, -1)
    if abs(a1) > abs(a2):
        r = k
    else:
        l = k
    if abs(abs(a1)-abs(a2)) < min:
        min = abs(abs(a1)-abs(a2))
        ans = abs(a1)
        if abs(a2) > abs(a1):
            ans = abs(a1)
    if r-l < 1e-6:
        break

print(ans)

