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

diff = []

for i in range(n+1):
  diff.append(abs(2*sum(w[:i]) - sum(w)))

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

diff = []

for i in range(n+1):
  diff.append(abs(2*sum(w[:i]) - sum(w)))

print(min(diff))
