n=int(input())
w=list(map(int,input().split()))
s1,s2,ans=0,sum(w),1000
for t in range(n):
    s1+=w[t]
    s2-=w[t]
    if abs(s1-s2)<ans:
        ans=abs(s1-s2)
        
print(ans) 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 s1,s2,ans=0,sum(w),1000 s1 0 s2 sum(w) sum w ans 1000 for t in range(n):
    s1+=w[t]
    s2-=w[t]
    if abs(s1-s2)<ans:
        ans=abs(s1-s2)
         t range(n) range n s1+=w[t] s1 w[t] w t s2-=w[t] s2 w[t] w t if abs(s1-s2)<ans:
        ans=abs(s1-s2)
         abs(s1-s2)<ans abs(s1-s2) abs s1-s2 s1 s2 ans ans=abs(s1-s2) ans abs(s1-s2) abs s1-s2 s1 s2 print(ans) print ans ans=0,sum(w),1000 1000 ans n=int(input()) int(input()) n s1+=w[t] w[t] s1 ans=abs(s1-s2) abs(s1-s2) ans w=list(map(int,input().split())) list(map(int,input().split())) w s2-=w[t] w[t] s2 s1,s2,ans=0,sum(w),1000 0 s1 s2,ans=0,sum(w),1000 sum(w) s2
n=int(input())
w=list(map(int,input().split()))
s1,s2,ans=0,sum(w),1000
for t in range(n):
    s1+=w[t]
    s2-=w[t]
    if abs(s1-s2)<ans:
        ans=abs(s1-s2)
        
print(ans)