N=int(input())
W=list(map(int,input().split()))
l=[]
for i in range(1,N+1):
    S1=0
    S2=0
    for j in range(N):
        if (j+1)<=i:
            S1+=W[j]
        else:
            S2+=W[j]
    l.append(abs(S1-S2))
print(min(l)) 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 l=[] l [] for i in range(1,N+1):
    S1=0
    S2=0
    for j in range(N):
        if (j+1)<=i:
            S1+=W[j]
        else:
            S2+=W[j]
    l.append(abs(S1-S2)) i range(1,N+1) range 1 N+1 N 1 S1=0 S1 0 S2=0 S2 0 for j in range(N):
        if (j+1)<=i:
            S1+=W[j]
        else:
            S2+=W[j]
     j range(N) range N if (j+1)<=i:
            S1+=W[j]
        else:
            S2+=W[j]
     (j+1)<=i j+1 j 1 i S1+=W[j] S1 W[j] W j S2+=W[j] S2 W[j] W j l.append(abs(S1-S2)) l.append l append abs(S1-S2) abs S1-S2 S1 S2 print(min(l)) print min(l) min l S1=0 0 S1 S1+=W[j] W[j] S1 N=int(input()) int(input()) N W=list(map(int,input().split())) list(map(int,input().split())) W S2=0 0 S2 S2+=W[j] W[j] S2 l=[] [] l
N=int(input())
W=list(map(int,input().split()))
l=[]
for i in range(1,N+1):
    S1=0
    S2=0
    for j in range(N):
        if (j+1)<=i:
            S1+=W[j]
        else:
            S2+=W[j]
    l.append(abs(S1-S2))
print(min(l))