n = int(input())
w = list(map(int, input().split()))
x = 10000
for i in range(n+1):
    num = 0
    for j in range(i):
        num += w[j]
    x = min(x, abs((sum(w) - num) - num))
print(x) 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 x = 10000 x 10000 for i in range(n+1):
    num = 0
    for j in range(i):
        num += w[j]
    x = min(x, abs((sum(w) - num) - num)) i range(n+1) range n+1 n 1 num = 0 num 0 for j in range(i):
        num += w[j]
     j range(i) range i num += w[j] num w[j] w j x = min(x, abs((sum(w) - num) - num)) x min(x, abs((sum(w) - num) - num)) min x abs((sum(w) - num) - num) abs (sum(w) - num) - num sum(w) - num sum(w) sum w num num print(x) print x w = list(map(int, input().split())) list(map(int, input().split())) w x = 10000 10000 x num += w[j] w[j] num num = 0 0 num x = min(x, abs((sum(w) - num) - num)) min(x, abs((sum(w) - num) - num)) x n = int(input()) int(input()) n
n = int(input())
w = list(map(int, input().split()))
x = 10000
for i in range(n+1):
    num = 0
    for j in range(i):
        num += w[j]
    x = min(x, abs((sum(w) - num) - num))
print(x)