n=int(input())
w=list(map(int,input().split()))
c,d,e=0,sum(w),sum(w)
for i in range(n):
  c+=w[i]
  d-=w[i]
  e=min(e,abs(c-d))
print(e) n=int(input()) n int(input()) int input() input w=list(map(int,input().split())) w list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split c,d,e=0,sum(w),sum(w) c 0 d sum(w) sum w e sum(w) sum w for i in range(n):
  c+=w[i]
  d-=w[i]
  e=min(e,abs(c-d)) i range(n) range n c+=w[i] c w[i] w i d-=w[i] d w[i] w i e=min(e,abs(c-d)) e min(e,abs(c-d)) min e abs(c-d) abs c-d c d print(e) print e d-=w[i] w[i] d d,e=0,sum(w),sum(w) sum(w) d c,d,e=0,sum(w),sum(w) 0 c e=0,sum(w),sum(w) sum(w) e n=int(input()) int(input()) n e=min(e,abs(c-d)) min(e,abs(c-d)) e w=list(map(int,input().split())) list(map(int,input().split())) w c+=w[i] w[i] c
n=int(input())
w=list(map(int,input().split()))
c,d,e=0,sum(w),sum(w)
for i in range(n):
  c+=w[i]
  d-=w[i]
  e=min(e,abs(c-d))
print(e)