n = int(input())
w = list(map(int, input().split()))
sum_w = sum(w)
ans = 100000

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

t = 0
for i in range(n):
    t += w[i]
    ans = min(ans, abs(sum_w - 2*t))
print(ans)
