N = int(input())
W = [int(n) for n in input().split()]
W_ = [W[0]]

for i in range(1, N):
    W_.append(W_[-1] + W[i])
#print(W_)

d_min = 100000
for i in range(N):
    d = abs(2 * W_[i] - W_[-1])
    d_min = min(d_min, d)

print(d_min) N = int(input()) N int(input()) int input() input int(n) for n in input().split() for n in input().split() n input().split() ().split () input split for n in input().split() int(n) int n W = [int(n) for n in input().split()] W [int(n) for n in input().split()] W_ = [W[0]] W_ [W[0]] W[0] W 0 for i in range(1, N):
    W_.append(W_[-1] + W[i])
#print(W_) i range(1, N) range 1 N W_.append(W_[-1] + W[i]) W_.append W_ append W_[-1] + W[i] W_[-1] W_ -1 W[i] W i d_min = 100000 d_min 100000 for i in range(N):
    d = abs(2 * W_[i] - W_[-1])
    d_min = min(d_min, d) i range(N) range N d = abs(2 * W_[i] - W_[-1]) d abs(2 * W_[i] - W_[-1]) abs 2 * W_[i] - W_[-1] 2 * W_[i] 2 W_[i] W_ i W_[-1] W_ -1 d_min = min(d_min, d) d_min min(d_min, d) min d_min d print(d_min) print d_min d = abs(2 * W_[i] - W_[-1]) abs(2 * W_[i] - W_[-1]) d d_min = 100000 100000 d_min d_min = min(d_min, d) min(d_min, d) d_min W = [int(n) for n in input().split()] [int(n) for n in input().split()] W N = int(input()) int(input()) N W_ = [W[0]] [W[0]] W_
N = int(input())
W = [int(n) for n in input().split()]
W_ = [W[0]]

for i in range(1, N):
    W_.append(W_[-1] + W[i])
#print(W_)

d_min = 100000
for i in range(N):
    d = abs(2 * W_[i] - W_[-1])
    d_min = min(d_min, d)

print(d_min)
