N = int(input())
W = [int(x) for x in input().split()]
res = 1000
for i in range(1,N-1):
  r = W[0:i+1]
  l = W[i+1:N]
  R = sum(r)
  L = sum(l)
  a = abs(R-L)
  if a < res:
    res = a
print(res) N = int(input()) N int(input()) int input() input int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x W = [int(x) for x in input().split()] W [int(x) for x in input().split()] res = 1000 res 1000 for i in range(1,N-1):
  r = W[0:i+1]
  l = W[i+1:N]
  R = sum(r)
  L = sum(l)
  a = abs(R-L)
  if a < res:
    res = a i range(1,N-1) range 1 N-1 N 1 r = W[0:i+1] r W[0:i+1] W 0:i+1 0 i+1 i 1 l = W[i+1:N] l W[i+1:N] W i+1:N i+1 i 1 N R = sum(r) R sum(r) sum r L = sum(l) L sum(l) sum l a = abs(R-L) a abs(R-L) abs R-L R L if a < res:
    res = a a < res a res res = a res a print(res) print res l = W[i+1:N] W[i+1:N] l R = sum(r) sum(r) R L = sum(l) sum(l) L r = W[0:i+1] W[0:i+1] r res = a a res N = int(input()) int(input()) N a = abs(R-L) abs(R-L) a res = 1000 1000 res W = [int(x) for x in input().split()] [int(x) for x in input().split()] W
N = int(input())
W = [int(x) for x in input().split()]
res = 1000
for i in range(1,N-1):
  r = W[0:i+1]
  l = W[i+1:N]
  R = sum(r)
  L = sum(l)
  a = abs(R-L)
  if a < res:
    res = a
print(res)