n = int(input())
W = list(map(int,input().split()))
ans = sum(W)
for t in range(1,100):
  x = 0
  y = 0
  for i in range(n):
    if i<=t:
      x+=W[i]
    else:
      y+=W[i]
  ans = min(ans,abs(x-y))
print(ans) 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 ans = sum(W) ans sum(W) sum W for t in range(1,100):
  x = 0
  y = 0
  for i in range(n):
    if i<=t:
      x+=W[i]
    else:
      y+=W[i]
  ans = min(ans,abs(x-y)) t range(1,100) range 1 100 x = 0 x 0 y = 0 y 0 for i in range(n):
    if i<=t:
      x+=W[i]
    else:
      y+=W[i]
   i range(n) range n if i<=t:
      x+=W[i]
    else:
      y+=W[i]
   i<=t i t x+=W[i] x W[i] W i y+=W[i] y W[i] W i ans = min(ans,abs(x-y)) ans min(ans,abs(x-y)) min ans abs(x-y) abs x-y x y print(ans) print ans x = 0 0 x y = 0 0 y n = int(input()) int(input()) n W = list(map(int,input().split())) list(map(int,input().split())) W x+=W[i] W[i] x ans = sum(W) sum(W) ans ans = min(ans,abs(x-y)) min(ans,abs(x-y)) ans y+=W[i] W[i] y
n = int(input())
W = list(map(int,input().split()))
ans = sum(W)
for t in range(1,100):
  x = 0
  y = 0
  for i in range(n):
    if i<=t:
      x+=W[i]
    else:
      y+=W[i]
  ans = min(ans,abs(x-y))
print(ans)
