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