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