n = int(input())
w = list(map(int, input().split()))

ans = 99

for i in range(1, n):
    tmp = abs(sum(w[:i]) - sum(w[i:]))
    ans = min(tmp, ans)

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

ans = 99

for i in range(1, n):
    tmp = abs(sum(w[:i]) - sum(w[i:]))
    ans = min(tmp, ans)

print(ans)
