N=int(input())
weight=list(map(int,input().split()))
ans=1000
for i in range(N):
    sa=abs(sum(weight[:i+1])-sum(weight[i+1:]))
    if sa<ans: ans=sa
print(ans) N=int(input()) N int(input()) int input() input weight=list(map(int,input().split())) weight list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ans=1000 ans 1000 for i in range(N):
    sa=abs(sum(weight[:i+1])-sum(weight[i+1:]))
    if sa<ans: ans=sa i range(N) range N sa=abs(sum(weight[:i+1])-sum(weight[i+1:])) sa abs(sum(weight[:i+1])-sum(weight[i+1:])) abs sum(weight[:i+1])-sum(weight[i+1:]) sum(weight[:i+1]) sum weight[:i+1] weight :i+1 i+1 i 1 sum(weight[i+1:]) sum weight[i+1:] weight i+1: i+1 i 1 if sa<ans: an sa<ans sa ans print(ans) print ans ans=1000 1000 ans sa=abs(sum(weight[:i+1])-sum(weight[i+1:])) abs(sum(weight[:i+1])-sum(weight[i+1:])) sa N=int(input()) int(input()) N weight=list(map(int,input().split())) list(map(int,input().split())) weight
N=int(input())
weight=list(map(int,input().split()))
ans=1000
for i in range(N):
    sa=abs(sum(weight[:i+1])-sum(weight[i+1:]))
    if sa<ans: ans=sa
print(ans)
