N = int(input())
W = list(map(int, input().split()))

R = sum(W) - W[0]
L = W[0]
S = []
for i in range(1,N):
    S.append(abs(R - L))
    R -= W[i]
    L += W[i]

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

R = sum(W) - W[0]
L = W[0]
S = []
for i in range(1,N):
    S.append(abs(R - L))
    R -= W[i]
    L += W[i]

print(min(S))