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