n=int(input())
W=list(map(int,input().split()))
ans = 1000000
for i in range(n):
  ans = min(ans,abs(sum(W[:i+1])-sum(W[i+1:])))
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 ans = 1000000 ans 1000000 for i in range(n):
  ans = min(ans,abs(sum(W[:i+1])-sum(W[i+1:]))) i range(n) range n ans = min(ans,abs(sum(W[:i+1])-sum(W[i+1:]))) ans min(ans,abs(sum(W[:i+1])-sum(W[i+1:]))) min ans abs(sum(W[:i+1])-sum(W[i+1:])) abs sum(W[:i+1])-sum(W[i+1:]) sum(W[:i+1]) sum W[:i+1] W :i+1 i+1 i 1 sum(W[i+1:]) sum W[i+1:] W i+1: i+1 i 1 print(ans) print ans W=list(map(int,input().split())) list(map(int,input().split())) W ans = 1000000 1000000 ans n=int(input()) int(input()) n ans = min(ans,abs(sum(W[:i+1])-sum(W[i+1:]))) min(ans,abs(sum(W[:i+1])-sum(W[i+1:]))) ans
n=int(input())
W=list(map(int,input().split()))
ans = 1000000
for i in range(n):
  ans = min(ans,abs(sum(W[:i+1])-sum(W[i+1:])))
print(ans)