N = int(input())
W = [int(i) for i in input().split()]
S = 0
for i in range(N):
    S += W[i]
ans = 99999

for i in range(1,N+1):
    S1 = 0
    for j in range(i):
        S1 += W[j]
    S2 = S - S1
    ans = min(ans,abs(S1-S2))

print(ans) N = int(input()) N int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i W = [int(i) for i in input().split()] W [int(i) for i in input().split()] S = 0 S 0 for i in range(N):
    S += W[i] i range(N) range N S += W[i] S W[i] W i ans = 99999 ans 99999 for i in range(1,N+1):
    S1 = 0
    for j in range(i):
        S1 += W[j]
    S2 = S - S1
    ans = min(ans,abs(S1-S2)) i range(1,N+1) range 1 N+1 N 1 S1 = 0 S1 0 for j in range(i):
        S1 += W[j]
     j range(i) range i S1 += W[j] S1 W[j] W j S2 = S - S1 S2 S - S1 S S1 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 S = 0 0 S ans = 99999 99999 ans S2 = S - S1 S - S1 S2 S1 = 0 0 S1 S1 += W[j] W[j] S1 S += W[i] W[i] S N = int(input()) int(input()) N ans = min(ans,abs(S1-S2)) min(ans,abs(S1-S2)) ans W = [int(i) for i in input().split()] [int(i) for i in input().split()] W
N = int(input())
W = [int(i) for i in input().split()]
S = 0
for i in range(N):
    S += W[i]
ans = 99999

for i in range(1,N+1):
    S1 = 0
    for j in range(i):
        S1 += W[j]
    S2 = S - S1
    ans = min(ans,abs(S1-S2))

print(ans)