mina=10**10
a=int(input())
L=list(map(int,input().split()))
c=sum(L)
for i in range(a):
  d=c-sum(L[:i+1])
  mina=min(mina,abs(d-sum(L[:i+1])))
print(mina) mina=10**10 mina 10**10 10 10 a=int(input()) a 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 c=sum(L) c sum(L) sum L for i in range(a):
  d=c-sum(L[:i+1])
  mina=min(mina,abs(d-sum(L[:i+1]))) i range(a) range a d=c-sum(L[:i+1]) d c-sum(L[:i+1]) c sum(L[:i+1]) sum L[:i+1] L :i+1 i+1 i 1 mina=min(mina,abs(d-sum(L[:i+1]))) mina min(mina,abs(d-sum(L[:i+1]))) min mina abs(d-sum(L[:i+1])) abs d-sum(L[:i+1]) d sum(L[:i+1]) sum L[:i+1] L :i+1 i+1 i 1 print(mina) print mina L=list(map(int,input().split())) list(map(int,input().split())) L mina=10**10 10**10 mina a=int(input()) int(input()) a mina=min(mina,abs(d-sum(L[:i+1]))) min(mina,abs(d-sum(L[:i+1]))) mina c=sum(L) sum(L) c d=c-sum(L[:i+1]) c-sum(L[:i+1]) d
mina=10**10
a=int(input())
L=list(map(int,input().split()))
c=sum(L)
for i in range(a):
  d=c-sum(L[:i+1])
  mina=min(mina,abs(d-sum(L[:i+1])))
print(mina)