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

ans = 100000000

for i in range(n-1):
    left = sum(w[:i+1])
    right = sum(w[i+1:])
    a = abs(left-right)
    if a<ans:
        ans=a

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 = 100000000 ans 100000000 for i in range(n-1):
    left = sum(w[:i+1])
    right = sum(w[i+1:])
    a = abs(left-right)
    if a<ans:
        ans=a i range(n-1) range n-1 n 1 left = sum(w[:i+1]) left sum(w[:i+1]) sum w[:i+1] w :i+1 i+1 i 1 right = sum(w[i+1:]) right sum(w[i+1:]) sum w[i+1:] w i+1: i+1 i 1 a = abs(left-right) a abs(left-right) abs left-right left right if a<ans:
        ans=a a<ans a ans ans=a ans a print(ans) print ans ans = 100000000 100000000 ans w = list(map(int, input().split())) list(map(int, input().split())) w a = abs(left-right) abs(left-right) a n = int(input()) int(input()) n ans=a a ans right = sum(w[i+1:]) sum(w[i+1:]) right left = sum(w[:i+1]) sum(w[:i+1]) left
n = int(input())
w = list(map(int, input().split()))

ans = 100000000

for i in range(n-1):
    left = sum(w[:i+1])
    right = sum(w[i+1:])
    a = abs(left-right)
    if a<ans:
        ans=a

print(ans)