n = int(input())
w = list(map(int, input().split()))

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

print(min([abs(sum(w[:i])-sum(w[i:])) for i in range(n)]))