n = int(input())
w = list(map(int, input().split()))
t = 10**9
for i in range(1,n):
    s1 = sum(w[:i])
    s2 = sum(w[i:])
    if abs(s1-s2) < t:
        t = abs(s1-s2)
print(t) 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 t = 10**9 t 10**9 10 9 for i in range(1,n):
    s1 = sum(w[:i])
    s2 = sum(w[i:])
    if abs(s1-s2) < t:
        t = abs(s1-s2) i range(1,n) range 1 n s1 = sum(w[:i]) s1 sum(w[:i]) sum w[:i] w :i i s2 = sum(w[i:]) s2 sum(w[i:]) sum w[i:] w i: i if abs(s1-s2) < t:
        t = abs(s1-s2) abs(s1-s2) < t abs(s1-s2) abs s1-s2 s1 s2 t t = abs(s1-s2) t abs(s1-s2) abs s1-s2 s1 s2 print(t) print t w = list(map(int, input().split())) list(map(int, input().split())) w s1 = sum(w[:i]) sum(w[:i]) s1 s2 = sum(w[i:]) sum(w[i:]) s2 t = 10**9 10**9 t t = abs(s1-s2) abs(s1-s2) t n = int(input()) int(input()) n
n = int(input())
w = list(map(int, input().split()))
t = 10**9
for i in range(1,n):
    s1 = sum(w[:i])
    s2 = sum(w[i:])
    if abs(s1-s2) < t:
        t = abs(s1-s2)
print(t)