n = int(input())
w = list(map(int, input().split()))
sum_w = sum(w)
res = 10**6
count_up = 0
for i in range(n):
    count_up += w[i]
    sum_w -= w[i]
    if abs(sum_w - count_up) < res:
        res = abs(sum_w - count_up)
print(res)
     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 sum_w = sum(w) sum_w sum(w) sum w res = 10**6 res 10**6 10 6 count_up = 0 count_up 0 for i in range(n):
    count_up += w[i]
    sum_w -= w[i]
    if abs(sum_w - count_up) < res:
        res = abs(sum_w - count_up) i range(n) range n count_up += w[i] count_up w[i] w i sum_w -= w[i] sum_w w[i] w i if abs(sum_w - count_up) < res:
        res = abs(sum_w - count_up) abs(sum_w - count_up) < res abs(sum_w - count_up) abs sum_w - count_up sum_w count_up res res = abs(sum_w - count_up) res abs(sum_w - count_up) abs sum_w - count_up sum_w count_up print(res) print res n = int(input()) int(input()) n res = 10**6 10**6 res sum_w -= w[i] w[i] sum_w res = abs(sum_w - count_up) abs(sum_w - count_up) res sum_w = sum(w) sum(w) sum_w count_up = 0 0 count_up w = list(map(int, input().split())) list(map(int, input().split())) w count_up += w[i] w[i] count_up
n = int(input())
w = list(map(int, input().split()))
sum_w = sum(w)
res = 10**6
count_up = 0
for i in range(n):
    count_up += w[i]
    sum_w -= w[i]
    if abs(sum_w - count_up) < res:
        res = abs(sum_w - count_up)
print(res)
    
