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

min = 999999999

for i in range(1, N):
    left = W[:i]
    right = W[i:]

    if abs(sum(left)-sum(right)) < min:
        min = abs(sum(left)-sum(right))


print(min) 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 min = 999999999 min 999999999 for i in range(1, N):
    left = W[:i]
    right = W[i:]

    if abs(sum(left)-sum(right)) < min:
        min = abs(sum(left)-sum(right)) i range(1, N) range 1 N left = W[:i] left W[:i] W :i i right = W[i:] right W[i:] W i: i if abs(sum(left)-sum(right)) < min:
        min = abs(sum(left)-sum(right)) abs(sum(left)-sum(right)) < min abs(sum(left)-sum(right)) abs sum(left)-sum(right) sum(left) sum left sum(right) sum right min min = abs(sum(left)-sum(right)) min abs(sum(left)-sum(right)) abs sum(left)-sum(right) sum(left) sum left sum(right) sum right print(min) print min min = abs(sum(left)-sum(right)) abs(sum(left)-sum(right)) min W = list(map(int, input().split())) list(map(int, input().split())) W left = W[:i] W[:i] left right = W[i:] W[i:] right min = 999999999 999999999 min N = int(input()) int(input()) N
N = int(input())
W = list(map(int, input().split()))

min = 999999999

for i in range(1, N):
    left = W[:i]
    right = W[i:]

    if abs(sum(left)-sum(right)) < min:
        min = abs(sum(left)-sum(right))


print(min)