n = int(input())
w = list(map(int, input().split()))
w_list = []
for i in range(n):
    w_list.append([w[:i],w[i:]])
del w_list[0]
l = []
for j in w_list:
    l.append(abs(sum(j[0])-sum(j[1])))
print(min(l)) 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 w_list = [] w_list [] for i in range(n):
    w_list.append([w[:i],w[i:]]) i range(n) range n w_list.append([w[:i],w[i:]]) w_list.append w_list append [w[:i],w[i:]] w[:i] w :i i w[i:] w i: i del w_list[0] w_list[0] w_list 0 l = [] l [] for j in w_list:
    l.append(abs(sum(j[0])-sum(j[1]))) j w_list l.append(abs(sum(j[0])-sum(j[1]))) l.append l append abs(sum(j[0])-sum(j[1])) abs sum(j[0])-sum(j[1]) sum(j[0]) sum j[0] j 0 sum(j[1]) sum j[1] j 1 print(min(l)) print min(l) min l w = list(map(int, input().split())) list(map(int, input().split())) w w_list = [] [] w_list n = int(input()) int(input()) n l = [] [] l
n = int(input())
w = list(map(int, input().split()))
w_list = []
for i in range(n):
    w_list.append([w[:i],w[i:]])
del w_list[0]
l = []
for j in w_list:
    l.append(abs(sum(j[0])-sum(j[1])))
print(min(l))