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

ans = 10**7

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

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

ans = 10**7

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

print(ans)