N=int(input())
W=list(map(int,input().split()))
l=[]
s=sum(W)
for i in range(N-1):
    x=abs(2*(sum(W[0:i+1]))-s)
    l.append(x)
print(min(l)) 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 l=[] l [] s=sum(W) s sum(W) sum W for i in range(N-1):
    x=abs(2*(sum(W[0:i+1]))-s)
    l.append(x) i range(N-1) range N-1 N 1 x=abs(2*(sum(W[0:i+1]))-s) x abs(2*(sum(W[0:i+1]))-s) abs 2*(sum(W[0:i+1]))-s 2*(sum(W[0:i+1])) 2 sum(W[0:i+1]) sum W[0:i+1] W 0:i+1 0 i+1 i 1 s l.append(x) l.append l append x print(min(l)) print min(l) min l x=abs(2*(sum(W[0:i+1]))-s) abs(2*(sum(W[0:i+1]))-s) x W=list(map(int,input().split())) list(map(int,input().split())) W N=int(input()) int(input()) N l=[] [] l s=sum(W) sum(W) s
N=int(input())
W=list(map(int,input().split()))
l=[]
s=sum(W)
for i in range(N-1):
    x=abs(2*(sum(W[0:i+1]))-s)
    l.append(x)
print(min(l))
