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