n = int(input())
w = list(map(int, input().split()))
z = []
for i in range(n):
    x = sum(w[:i])
    y = sum(w[i:])
    z.append(abs(x-y))
print(min(z)) 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 z = [] z [] for i in range(n):
    x = sum(w[:i])
    y = sum(w[i:])
    z.append(abs(x-y)) i range(n) range n x = sum(w[:i]) x sum(w[:i]) sum w[:i] w :i i y = sum(w[i:]) y sum(w[i:]) sum w[i:] w i: i z.append(abs(x-y)) z.append z append abs(x-y) abs x-y x y print(min(z)) print min(z) min z x = sum(w[:i]) sum(w[:i]) x w = list(map(int, input().split())) list(map(int, input().split())) w z = [] [] z n = int(input()) int(input()) n y = sum(w[i:]) sum(w[i:]) y
n = int(input())
w = list(map(int, input().split()))
z = []
for i in range(n):
    x = sum(w[:i])
    y = sum(w[i:])
    z.append(abs(x-y))
print(min(z))
