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

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

m = abs(sum(w[:1])-sum(w[1:]))
for i in range(1,n):
    t = abs(sum(w[:i])-sum(w[i:]))
    if m > t:
        m = t
print(m)
