n,*a=list(map(int,open(0).read().split()))

ans=10**100

b=sum(a)

c=0

for i in a[:-1]:

   c+=i

   b-=i

   ans=min(ans,abs(b-c))

print(ans)
n,*a=list(map(int,open(0).read().split()))

b=sum(a)

c=a[0]

ans=abs(2*c-b)

for i in a[1:-1]:

    c+=i

    ans=min(ans,abs(2*c-b))

print(ans)
n, *a = list(map(int, open(0).read().split()))
ans = 10**100
b = sum(a)
c = 0
for i in a[:-1]:
    c += i
    b -= i
    ans = min(ans, abs(b - c))
print(ans)

n, *a = list(map(int, open(0).read().split()))
b = sum(a)
c = a[0]
ans = abs(2 * c - b)
for i in a[1:-1]:
    c += i
    ans = min(ans, abs(2 * c - b))
print(ans)

-ans = 10**100 -c = 0 -for i in a[:-1]: +c = a[0] +ans = abs(2 * c - b) +for i in a[1:-1]: -    b -= i -    ans = min(ans, abs(b - c)) +    ans = min(ans, abs(2 * c - b))