N = int(input())
W = list(map(int, input().split()))

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

diff = [0 for i in range(N-1)]
for i in range(N-1):
  S1 = sum(W[:i+1])
  S2 = sum(W[i+1:])
  diff[i] = abs(S1 - S2)
print(min(diff))