n = int(input())
W = list(map(int, input().split()))
S = sum(W)

ans = abs(W[0] - (S - W[0]))
for i in range(1,n):
  k = abs(sum(W[0:i+1]) - (S - sum(W[0:i+1])))
  if k > ans:
    print(ans)
    exit()
  else:
    ans = k 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 S = sum(W) S sum(W) sum W ans = abs(W[0] - (S - W[0])) ans abs(W[0] - (S - W[0])) abs W[0] - (S - W[0]) W[0] W 0 S - W[0] S W[0] W 0 for i in range(1,n):
  k = abs(sum(W[0:i+1]) - (S - sum(W[0:i+1])))
  if k > ans:
    print(ans)
    exit()
  else:
    ans = k i range(1,n) range 1 n k = abs(sum(W[0:i+1]) - (S - sum(W[0:i+1]))) k abs(sum(W[0:i+1]) - (S - sum(W[0:i+1]))) abs sum(W[0:i+1]) - (S - sum(W[0:i+1])) sum(W[0:i+1]) sum W[0:i+1] W 0:i+1 0 i+1 i 1 S - sum(W[0:i+1]) S sum(W[0:i+1]) sum W[0:i+1] W 0:i+1 0 i+1 i 1 if k > ans:
    print(ans)
    exit()
  else:
    ans = k k > ans k ans print(ans) print ans exit() exit ans = k ans k n = int(input()) int(input()) n k = abs(sum(W[0:i+1]) - (S - sum(W[0:i+1]))) abs(sum(W[0:i+1]) - (S - sum(W[0:i+1]))) k ans = abs(W[0] - (S - W[0])) abs(W[0] - (S - W[0])) ans W = list(map(int, input().split())) list(map(int, input().split())) W S = sum(W) sum(W) S ans = k k ans
n = int(input())
W = list(map(int, input().split()))
S = sum(W)

ans = abs(W[0] - (S - W[0]))
for i in range(1,n):
  k = abs(sum(W[0:i+1]) - (S - sum(W[0:i+1])))
  if k > ans:
    print(ans)
    exit()
  else:
    ans = k