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

ans = 10000

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

ans = 10000

for i in range(n):
    w1 = sum(w[:i])
    w2 = sum(w[i:])
    if ans > abs(w1-w2):
        ans = abs(w1-w2)
print(ans)