N = int(input())
W = list(map(lambda w: int(w), input().split(" ")))

ary = []
a = 0
s = sum(W)

for i in range(N):
  a += W[i]
  ary.append(abs(s - 2 * a))

print(min(ary)) N = int(input()) N int(input()) int input() input W = list(map(lambda w: int(w), input().split(" "))) W list(map(lambda w: int(w), input().split(" "))) list map(lambda w: int(w), input().split(" ")) map lambda w: int(w) int(w) int w w input().split(" ") ().split () input split " " ary = [] ary [] a = 0 a 0 s = sum(W) s sum(W) sum W for i in range(N):
  a += W[i]
  ary.append(abs(s - 2 * a)) i range(N) range N a += W[i] a W[i] W i ary.append(abs(s - 2 * a)) ary.append ary append abs(s - 2 * a) abs s - 2 * a s 2 * a 2 a print(min(ary)) print min(ary) min ary W = list(map(lambda w: int(w), input().split(" "))) list(map(lambda w: int(w), input().split(" "))) W a = 0 0 a N = int(input()) int(input()) N s = sum(W) sum(W) s a += W[i] W[i] a ary = [] [] ary
N = int(input())
W = list(map(lambda w: int(w), input().split(" ")))

ary = []
a = 0
s = sum(W)

for i in range(N):
  a += W[i]
  ary.append(abs(s - 2 * a))

print(min(ary))