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

ans = 10**5
for i in range(N-1):
    a = sum(W[:i + 1])
    b = sum(W[i + 1:])
    if abs(a-b) < ans:
        ans = abs(a-b)
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 = 10**5 ans 10**5 10 5 for i in range(N-1):
    a = sum(W[:i + 1])
    b = sum(W[i + 1:])
    if abs(a-b) < ans:
        ans = abs(a-b) i range(N-1) range N-1 N 1 a = sum(W[:i + 1]) a sum(W[:i + 1]) sum W[:i + 1] W :i + 1 i + 1 i 1 b = sum(W[i + 1:]) b sum(W[i + 1:]) sum W[i + 1:] W i + 1: i + 1 i 1 if abs(a-b) < ans:
        ans = abs(a-b) abs(a-b) < ans abs(a-b) abs a-b a b ans ans = abs(a-b) ans abs(a-b) abs a-b a b print(ans) print ans N = int(input()) int(input()) N a = sum(W[:i + 1]) sum(W[:i + 1]) a b = sum(W[i + 1:]) sum(W[i + 1:]) b W = list(map(int, input().split())) list(map(int, input().split())) W ans = abs(a-b) abs(a-b) ans ans = 10**5 10**5 ans
N = int(input())
W = list(map(int, input().split()))

ans = 10**5
for i in range(N-1):
    a = sum(W[:i + 1])
    b = sum(W[i + 1:])
    if abs(a-b) < ans:
        ans = abs(a-b)
print(ans)
