N = int(input())
*W, = map(int, input().split())
 
s1, s2 = 0, sum(W)
ans = sum(W)
 
for i in range(N):
  s1 += W[i]
  s2 -= W[i]
  ans = min(ans, abs(s1 - s2))
print(ans) N = int(input()) N int(input()) int input() input *W, = map(int, input().split()) *W W map(int, input().split()) map int input().split() ().split () input split s1, s2 = 0, sum(W) s1 0 s2 sum(W) sum W ans = sum(W) ans sum(W) sum W for i in range(N):
  s1 += W[i]
  s2 -= W[i]
  ans = min(ans, abs(s1 - s2)) i range(N) range N s1 += W[i] s1 W[i] W i s2 -= W[i] s2 W[i] W i ans = min(ans, abs(s1 - s2)) ans min(ans, abs(s1 - s2)) min ans abs(s1 - s2) abs s1 - s2 s1 s2 print(ans) print ans s2 -= W[i] W[i] s2 ans = sum(W) sum(W) ans ans = min(ans, abs(s1 - s2)) min(ans, abs(s1 - s2)) ans N = int(input()) int(input()) N s1, s2 = 0, sum(W) 0 s1 s1 += W[i] W[i] s1 s2 = 0, sum(W) sum(W) s2
N = int(input())
*W, = map(int, input().split())
 
s1, s2 = 0, sum(W)
ans = sum(W)
 
for i in range(N):
  s1 += W[i]
  s2 -= W[i]
  ans = min(ans, abs(s1 - s2))
print(ans)