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