n = int(input())
w = list(map(int, input().split()))

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

ans = sum(w)
for t in range(0, n - 1):
    s1 = sum(w[0:t + 1])
    s2 = sum(w[t + 1:n])
    ans = min(ans, abs(s2 - s1))
print(ans)
