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