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

ans=10000000000000000
for t in range(N):
    sum1=0
    sum2=0
    for j in range(0,t+1):
        sum1+=W[j]
    for k in range(t+1,N):
        sum2+=W[k]
    if abs(sum2-sum1)<ans:
        ans=abs(sum2-sum1)
print(ans) 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 ans=10000000000000000 ans 10000000000000000 for t in range(N):
    sum1=0
    sum2=0
    for j in range(0,t+1):
        sum1+=W[j]
    for k in range(t+1,N):
        sum2+=W[k]
    if abs(sum2-sum1)<ans:
        ans=abs(sum2-sum1) t range(N) range N sum1=0 sum1 0 sum2=0 sum2 0 for j in range(0,t+1):
        sum1+=W[j]
     j range(0,t+1) range 0 t+1 t 1 sum1+=W[j] sum1 W[j] W j for k in range(t+1,N):
        sum2+=W[k]
     k range(t+1,N) range t+1 t 1 N sum2+=W[k] sum2 W[k] W k if abs(sum2-sum1)<ans:
        ans=abs(sum2-sum1) abs(sum2-sum1)<ans abs(sum2-sum1) abs sum2-sum1 sum2 sum1 ans ans=abs(sum2-sum1) ans abs(sum2-sum1) abs sum2-sum1 sum2 sum1 print(ans) print ans sum2+=W[k] W[k] sum2 sum2=0 0 sum2 sum1=0 0 sum1 ans=10000000000000000 10000000000000000 ans ans=abs(sum2-sum1) abs(sum2-sum1) ans N=int(input()) int(input()) N sum1+=W[j] W[j] sum1 W=list(map(int,input().split())) list(map(int,input().split())) W
N=int(input())
W=list(map(int,input().split()))

ans=10000000000000000
for t in range(N):
    sum1=0
    sum2=0
    for j in range(0,t+1):
        sum1+=W[j]
    for k in range(t+1,N):
        sum2+=W[k]
    if abs(sum2-sum1)<ans:
        ans=abs(sum2-sum1)
print(ans)
