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