n = int(input())
w = list(map(int, input().split()))
ans = float('inf')

for t in range(1, n):
    s1 = sum(w[:t])
    s2 = sum(w[t:])
    ans = min(abs(s1-s2), 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 = float('inf') ans float('inf') float 'inf' for t in range(1, n):
    s1 = sum(w[:t])
    s2 = sum(w[t:])
    ans = min(abs(s1-s2), ans) t range(1, n) range 1 n s1 = sum(w[:t]) s1 sum(w[:t]) sum w[:t] w :t t s2 = sum(w[t:]) s2 sum(w[t:]) sum w[t:] w t: t ans = min(abs(s1-s2), ans) ans min(abs(s1-s2), ans) min abs(s1-s2) abs s1-s2 s1 s2 ans print(ans) print ans n = int(input()) int(input()) n ans = float('inf') float('inf') ans s1 = sum(w[:t]) sum(w[:t]) s1 s2 = sum(w[t:]) sum(w[t:]) s2 w = list(map(int, input().split())) list(map(int, input().split())) w ans = min(abs(s1-s2), ans) min(abs(s1-s2), ans) ans
n = int(input())
w = list(map(int, input().split()))
ans = float('inf')

for t in range(1, n):
    s1 = sum(w[:t])
    s2 = sum(w[t:])
    ans = min(abs(s1-s2), ans)

print(ans)
