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