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