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

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

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