n = int(eval(input()))

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

cumsum = [a[0]]

for i in range(len(a)-1):

  cumsum.append(cumsum[i] + a[i+1])



min = float('inf')

for i in range(len(cumsum)-1):

  f1 = cumsum[i]

  f2 = cumsum[-1] - cumsum[i]

  d = abs(f1 - f2)

  if min >  d:

    min = d



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

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

sa = a[:]

for i in range(N-1):

  sa[i+1] += sa[i]



diff = float('inf')

for i in range(N-1):

  if abs(sa[i] - (sa[-1] - sa[i])) < diff:

    diff = abs(sa[i] - (sa[-1] - sa[i]))



print(diff)
n = int(eval(input()))
a = list(map(int, input().split()))
cumsum = [a[0]]
for i in range(len(a) - 1):
    cumsum.append(cumsum[i] + a[i + 1])
min = float("inf")
for i in range(len(cumsum) - 1):
    f1 = cumsum[i]
    f2 = cumsum[-1] - cumsum[i]
    d = abs(f1 - f2)
    if min > d:
        min = d
print(min)

N = int(eval(input()))
a = list(map(int, input().split()))
sa = a[:]
for i in range(N - 1):
    sa[i + 1] += sa[i]
diff = float("inf")
for i in range(N - 1):
    if abs(sa[i] - (sa[-1] - sa[i])) < diff:
        diff = abs(sa[i] - (sa[-1] - sa[i]))
print(diff)

-n = int(eval(input())) +N = int(eval(input())) -cumsum = [a[0]] -for i in range(len(a) - 1): -    cumsum.append(cumsum[i] + a[i + 1]) -min = float("inf") -for i in range(len(cumsum) - 1): -    f1 = cumsum[i] -    f2 = cumsum[-1] - cumsum[i] -    d = abs(f1 - f2) -    if min > d: -        min = d -print(min) +sa = a[:] +for i in range(N - 1): +    sa[i + 1] += sa[i] +diff = float("inf") +for i in range(N - 1): +    if abs(sa[i] - (sa[-1] - sa[i])) < diff: +        diff = abs(sa[i] - (sa[-1] - sa[i])) +print(diff)