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