N = int(input())
W = list(map(int, input().split()))
ans = 1000

for t in range(N):
    S1 = sum(W[:t])
    S2 = sum(W[t:])
    ans = min(ans, abs(S1 - S2))

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 = 1000 ans 1000 for t in range(N):
    S1 = sum(W[:t])
    S2 = sum(W[t:])
    ans = min(ans, abs(S1 - S2)) t range(N) range 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(ans, abs(S1 - S2)) ans min(ans, abs(S1 - S2)) min ans abs(S1 - S2) abs S1 - S2 S1 S2 print(ans) print ans W = list(map(int, input().split())) list(map(int, input().split())) W S1 = sum(W[:t]) sum(W[:t]) S1 N = int(input()) int(input()) N ans = 1000 1000 ans S2 = sum(W[t:]) sum(W[t:]) S2 ans = min(ans, abs(S1 - S2)) min(ans, abs(S1 - S2)) ans
N = int(input())
W = list(map(int, input().split()))
ans = 1000

for t in range(N):
    S1 = sum(W[:t])
    S2 = sum(W[t:])
    ans = min(ans, abs(S1 - S2))

print(ans)