N=int(eval(input()))

lst=[int(i) for i in input().split()]

import numpy

res=numpy.cumsum(lst)

ans=10e20

for i in range(N-1):

  ans=min(ans,abs(res[i]-(res[-1]-res[i])))

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

l=[int(i) for i in input().split()]

lst=[0]

for i in l:

    lst.append(lst[-1]+i)

sm=lst[-1]

ans=10**20

for i in range(1,n):

    x=lst[i]

    y=sm-x

    a=abs(x-y)

    ans=min(ans,a)

print(ans)
N = int(eval(input()))
lst = [int(i) for i in input().split()]
import numpy

res = numpy.cumsum(lst)
ans = 10e20
for i in range(N - 1):
    ans = min(ans, abs(res[i] - (res[-1] - res[i])))
print(ans)

n = int(eval(input()))
l = [int(i) for i in input().split()]
lst = [0]
for i in l:
    lst.append(lst[-1] + i)
sm = lst[-1]
ans = 10**20
for i in range(1, n):
    x = lst[i]
    y = sm - x
    a = abs(x - y)
    ans = min(ans, a)
print(ans)

-N = int(eval(input())) -lst = [int(i) for i in input().split()] -import numpy - -res = numpy.cumsum(lst) -ans = 10e20 -for i in range(N - 1): -    ans = min(ans, abs(res[i] - (res[-1] - res[i]))) +n = int(eval(input())) +l = [int(i) for i in input().split()] +lst = [0] +for i in l: +    lst.append(lst[-1] + i) +sm = lst[-1] +ans = 10**20 +for i in range(1, n): +    x = lst[i] +    y = sm - x +    a = abs(x - y) +    ans = min(ans, a)