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