n = int(input())
w = list(map(int, input().split()))
sum_w = sum(w)
total = 0
ans = 1000
for i in range(n):
    total += w[i]
    ans = min(ans, abs(sum_w - 2 * total))
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 sum_w = sum(w) sum_w sum(w) sum w total = 0 total 0 ans = 1000 ans 1000 for i in range(n):
    total += w[i]
    ans = min(ans, abs(sum_w - 2 * total)) i range(n) range n total += w[i] total w[i] w i ans = min(ans, abs(sum_w - 2 * total)) ans min(ans, abs(sum_w - 2 * total)) min ans abs(sum_w - 2 * total) abs sum_w - 2 * total sum_w 2 * total 2 total print(ans) print ans w = list(map(int, input().split())) list(map(int, input().split())) w total += w[i] w[i] total sum_w = sum(w) sum(w) sum_w total = 0 0 total n = int(input()) int(input()) n ans = 1000 1000 ans ans = min(ans, abs(sum_w - 2 * total)) min(ans, abs(sum_w - 2 * total)) ans
n = int(input())
w = list(map(int, input().split()))
sum_w = sum(w)
total = 0
ans = 1000
for i in range(n):
    total += w[i]
    ans = min(ans, abs(sum_w - 2 * total))
print(ans)
