n=int(input())
l=list(map(int,input().split()))
s=sum(l)
m=100000000
c=0
for i in range(n):
    c+=l[i]
    x=s-c
    d=abs(c-x)
    m=min(m,d)
print(m) 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 s=sum(l) s sum(l) sum l m=100000000 m 100000000 c=0 c 0 for i in range(n):
    c+=l[i]
    x=s-c
    d=abs(c-x)
    m=min(m,d) i range(n) range n c+=l[i] c l[i] l i x=s-c x s-c s c d=abs(c-x) d abs(c-x) abs c-x c x m=min(m,d) m min(m,d) min m d print(m) print m c+=l[i] l[i] c l=list(map(int,input().split())) list(map(int,input().split())) l m=100000000 100000000 m c=0 0 c n=int(input()) int(input()) n x=s-c s-c x d=abs(c-x) abs(c-x) d m=min(m,d) min(m,d) m s=sum(l) sum(l) s
n=int(input())
l=list(map(int,input().split()))
s=sum(l)
m=100000000
c=0
for i in range(n):
    c+=l[i]
    x=s-c
    d=abs(c-x)
    m=min(m,d)
print(m)
