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