N = int(input())
W = list(map(int, input().split()))
b = 0
a = sum(W)
diff = abs(b-a)
for i in range(N):
    b += W[i]
    a -= W[i]
    diff = min(diff,abs(b-a))
print(diff) 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 b = 0 b 0 a = sum(W) a sum(W) sum W diff = abs(b-a) diff abs(b-a) abs b-a b a for i in range(N):
    b += W[i]
    a -= W[i]
    diff = min(diff,abs(b-a)) i range(N) range N b += W[i] b W[i] W i a -= W[i] a W[i] W i diff = min(diff,abs(b-a)) diff min(diff,abs(b-a)) min diff abs(b-a) abs b-a b a print(diff) print diff diff = min(diff,abs(b-a)) min(diff,abs(b-a)) diff N = int(input()) int(input()) N a = sum(W) sum(W) a a -= W[i] W[i] a W = list(map(int, input().split())) list(map(int, input().split())) W b = 0 0 b b += W[i] W[i] b diff = abs(b-a) abs(b-a) diff
N = int(input())
W = list(map(int, input().split()))
b = 0
a = sum(W)
diff = abs(b-a)
for i in range(N):
    b += W[i]
    a -= W[i]
    diff = min(diff,abs(b-a))
print(diff)