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

B=[]
for i in range(N):
    A = abs(sum(W[0:i]) - sum(W[i:N]))
    B.append(A)
B.sort()    
print(B[0])    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 B=[] B [] for i in range(N):
    A = abs(sum(W[0:i]) - sum(W[i:N]))
    B.append(A) i range(N) range N A = abs(sum(W[0:i]) - sum(W[i:N])) A abs(sum(W[0:i]) - sum(W[i:N])) abs sum(W[0:i]) - sum(W[i:N]) sum(W[0:i]) sum W[0:i] W 0:i 0 i sum(W[i:N]) sum W[i:N] W i:N i N B.append(A) B.append B append A B.sort() B.sort B sort print(B[0]) print B[0] B 0 B=[] [] B N = int(input()) int(input()) N A = abs(sum(W[0:i]) - sum(W[i:N])) abs(sum(W[0:i]) - sum(W[i:N])) A
N = int(input())
*W, =map(int,input().split())

B=[]
for i in range(N):
    A = abs(sum(W[0:i]) - sum(W[i:N]))
    B.append(A)
B.sort()    
print(B[0])   