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