n = int(input())
w = list(map(int, input().split()))
s = sum(w)
counter = 0
ans = 1000000
for i in range(n):
    counter += w[i]
    rest = s - counter
    diff = abs(counter - rest)
    ans = min(ans, diff)
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 s = sum(w) s sum(w) sum w counter = 0 counter 0 ans = 1000000 ans 1000000 for i in range(n):
    counter += w[i]
    rest = s - counter
    diff = abs(counter - rest)
    ans = min(ans, diff) i range(n) range n counter += w[i] counter w[i] w i rest = s - counter rest s - counter s counter diff = abs(counter - rest) diff abs(counter - rest) abs counter - rest counter rest ans = min(ans, diff) ans min(ans, diff) min ans diff print(ans) print ans counter = 0 0 counter rest = s - counter s - counter rest s = sum(w) sum(w) s counter += w[i] w[i] counter diff = abs(counter - rest) abs(counter - rest) diff ans = 1000000 1000000 ans n = int(input()) int(input()) n w = list(map(int, input().split())) list(map(int, input().split())) w ans = min(ans, diff) min(ans, diff) ans
n = int(input())
w = list(map(int, input().split()))
s = sum(w)
counter = 0
ans = 1000000
for i in range(n):
    counter += w[i]
    rest = s - counter
    diff = abs(counter - rest)
    ans = min(ans, diff)
print(ans)