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

diffs = []
for n in range(1,N):
  w1 = W[:n]
  w2 = W[n:]
  
  su_w1 = sum(w1)
  su_w2 = sum(w2)
  
  diff = abs(su_w1 - su_w2)
  diffs.append(diff)
  
print(min(diffs)) N = int(input()) N int(input()) int input() input W = map(int, input().split()) W map(int, input().split()) map int input().split() ().split () input split W = list(W) W list(W) list W diffs = [] diffs [] for n in range(1,N):
  w1 = W[:n]
  w2 = W[n:]
  
  su_w1 = sum(w1)
  su_w2 = sum(w2)
  
  diff = abs(su_w1 - su_w2)
  diffs.append(diff)
   n range(1,N) range 1 N w1 = W[:n] w1 W[:n] W :n n w2 = W[n:] w2 W[n:] W n: n su_w1 = sum(w1) su_w1 sum(w1) sum w1 su_w2 = sum(w2) su_w2 sum(w2) sum w2 diff = abs(su_w1 - su_w2) diff abs(su_w1 - su_w2) abs su_w1 - su_w2 su_w1 su_w2 diffs.append(diff) diffs.append diffs append diff print(min(diffs)) print min(diffs) min diffs W = map(int, input().split()) map(int, input().split()) W N = int(input()) int(input()) N w2 = W[n:] W[n:] w2 w1 = W[:n] W[:n] w1 diffs = [] [] diffs su_w1 = sum(w1) sum(w1) su_w1 W = list(W) list(W) W su_w2 = sum(w2) sum(w2) su_w2 diff = abs(su_w1 - su_w2) abs(su_w1 - su_w2) diff
N = int(input())
W = map(int, input().split())
W = list(W)

diffs = []
for n in range(1,N):
  w1 = W[:n]
  w2 = W[n:]
  
  su_w1 = sum(w1)
  su_w2 = sum(w2)
  
  diff = abs(su_w1 - su_w2)
  diffs.append(diff)
  
print(min(diffs))