N = int(input())
W = list(map(int, input().split()))
ans = float("inf")
for i in range(N-1):
  ans = min(abs(sum(W[:i+1]) - sum(W[i+1:])), ans)
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 = float("inf") ans float("inf") float "inf" for i in range(N-1):
  ans = min(abs(sum(W[:i+1]) - sum(W[i+1:])), ans) i range(N-1) range N-1 N 1 ans = min(abs(sum(W[:i+1]) - sum(W[i+1:])), ans) ans min(abs(sum(W[:i+1]) - sum(W[i+1:])), ans) min abs(sum(W[:i+1]) - sum(W[i+1:])) abs sum(W[:i+1]) - sum(W[i+1:]) sum(W[:i+1]) sum W[:i+1] W :i+1 i+1 i 1 sum(W[i+1:]) sum W[i+1:] W i+1: i+1 i 1 ans print(ans) print ans ans = min(abs(sum(W[:i+1]) - sum(W[i+1:])), ans) min(abs(sum(W[:i+1]) - sum(W[i+1:])), ans) ans ans = float("inf") float("inf") ans 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()))
ans = float("inf")
for i in range(N-1):
  ans = min(abs(sum(W[:i+1]) - sum(W[i+1:])), ans)
print(ans)