n = int(eval(input()))

a = list(map(int, input().split()))

s = [0] * (n + 1)



for i in range(n):

    s[i + 1] = s[i] + a[i]



ans = 3e9

for i in range(n - 1):

    ans = min(ans, abs((s[n] - s[i + 1]) - s[i + 1]))

print(ans)
N=int(eval(input()))

A=list(map(int,input().split()))

s=[0]*(N+1)

for i in range(N): s[i + 1]=s[i]+A[i]

C=[0]*(N)

C[0]=-s[N]

x=10**10

p=0

for i in range(1, N):

    C[i]=C[i-1]+2*A[i-1]

    if x>abs(C[i]):

        x=abs(C[i])

        p=i

print(x)

#print(C)

n = int(eval(input()))
a = list(map(int, input().split()))
s = [0] * (n + 1)
for i in range(n):
    s[i + 1] = s[i] + a[i]
ans = 3e9
for i in range(n - 1):
    ans = min(ans, abs((s[n] - s[i + 1]) - s[i + 1]))
print(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
s = [0] * (N + 1)
for i in range(N):
    s[i + 1] = s[i] + A[i]
C = [0] * (N)
C[0] = -s[N]
x = 10**10
p = 0
for i in range(1, N):
    C[i] = C[i - 1] + 2 * A[i - 1]
    if x > abs(C[i]):
        x = abs(C[i])
        p = i
print(x)
# print(C)

-n = int(eval(input())) -a = list(map(int, input().split())) -s = [0] * (n + 1) -for i in range(n): -    s[i + 1] = s[i] + a[i] -ans = 3e9 -for i in range(n - 1): -    ans = min(ans, abs((s[n] - s[i + 1]) - s[i + 1])) -print(ans) +N = int(eval(input())) +A = list(map(int, input().split())) +s = [0] * (N + 1) +for i in range(N): +    s[i + 1] = s[i] + A[i] +C = [0] * (N) +C[0] = -s[N] +x = 10**10 +p = 0 +for i in range(1, N): +    C[i] = C[i - 1] + 2 * A[i - 1] +    if x > abs(C[i]): +        x = abs(C[i]) +        p = i +print(x) +# print(C)