n = int(input())
l = list(map(int,input().split()))

all_sum = sum(l)


minabs = float('INF')
a=all_sum
b=0
for i in range(n-2,-1,-1):
    a-=l[i+1]
    b+=l[i+1]

    target = abs(a-b)
    if(target<minabs):
        minabs=target
print(minabs) n = int(input()) n int(input()) int input() input l = list(map(int,input().split())) l list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split all_sum = sum(l) all_sum sum(l) sum l minabs = float('INF') minabs float('INF') float 'INF' a=all_sum a all_sum b=0 b 0 for i in range(n-2,-1,-1):
    a-=l[i+1]
    b+=l[i+1]

    target = abs(a-b)
    if(target<minabs):
        minabs=target i range(n-2,-1,-1) range n-2 n 2 -1 -1 a-=l[i+1] a l[i+1] l i+1 i 1 b+=l[i+1] b l[i+1] l i+1 i 1 target = abs(a-b) target abs(a-b) abs a-b a b if(target<minabs):
        minabs=target target<minabs target minabs minabs=target minabs target print(minabs) print minabs a-=l[i+1] l[i+1] a all_sum = sum(l) sum(l) all_sum b+=l[i+1] l[i+1] b n = int(input()) int(input()) n minabs = float('INF') float('INF') minabs l = list(map(int,input().split())) list(map(int,input().split())) l b=0 0 b target = abs(a-b) abs(a-b) target minabs=target target minabs a=all_sum all_sum a
n = int(input())
l = list(map(int,input().split()))

all_sum = sum(l)


minabs = float('INF')
a=all_sum
b=0
for i in range(n-2,-1,-1):
    a-=l[i+1]
    b+=l[i+1]

    target = abs(a-b)
    if(target<minabs):
        minabs=target
print(minabs)