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

ans = []
for T in range(N):
    result = abs(sum(W[:T+1]) - sum(W[T+1:]))
    ans.append(result)

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

ans = []
for T in range(N):
    result = abs(sum(W[:T+1]) - sum(W[T+1:]))
    ans.append(result)

print(min(ans))
