n =int(input())
min_value =1000000000000000000000000000
w = list(map(int,input().split()))
for i in range(n):
  a = sum(w[0:i])
  b = sum(w[i:n])
  if abs(a - b) < min_value:
    min_value = abs(a-b)
print(min_value) n =int(input()) n int(input()) int input() input min_value =1000000000000000000000000000 min_value 1000000000000000000000000000 w = list(map(int,input().split())) w list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for i in range(n):
  a = sum(w[0:i])
  b = sum(w[i:n])
  if abs(a - b) < min_value:
    min_value = abs(a-b) i range(n) range n a = sum(w[0:i]) a sum(w[0:i]) sum w[0:i] w 0:i 0 i b = sum(w[i:n]) b sum(w[i:n]) sum w[i:n] w i:n i n if abs(a - b) < min_value:
    min_value = abs(a-b) abs(a - b) < min_value abs(a - b) abs a - b a b min_value min_value = abs(a-b) min_value abs(a-b) abs a-b a b print(min_value) print min_value n =int(input()) int(input()) n a = sum(w[0:i]) sum(w[0:i]) a min_value = abs(a-b) abs(a-b) min_value min_value =1000000000000000000000000000 1000000000000000000000000000 min_value w = list(map(int,input().split())) list(map(int,input().split())) w b = sum(w[i:n]) sum(w[i:n]) b
n =int(input())
min_value =1000000000000000000000000000
w = list(map(int,input().split()))
for i in range(n):
  a = sum(w[0:i])
  b = sum(w[i:n])
  if abs(a - b) < min_value:
    min_value = abs(a-b)
print(min_value)