N = int(input())
W_ls = list(map(int, input().split(' ')))
diff_min = sum(W_ls)
for i in range(len(W_ls)):
    diff_min = min(diff_min, abs(sum(W_ls[:i]) - sum(W_ls[i:])))
print(diff_min) N = int(input()) N int(input()) int input() input W_ls = list(map(int, input().split(' '))) W_ls list(map(int, input().split(' '))) list map(int, input().split(' ')) map int input().split(' ') ().split () input split ' ' diff_min = sum(W_ls) diff_min sum(W_ls) sum W_ls for i in range(len(W_ls)):
    diff_min = min(diff_min, abs(sum(W_ls[:i]) - sum(W_ls[i:]))) i range(len(W_ls)) range len(W_ls) len W_ls diff_min = min(diff_min, abs(sum(W_ls[:i]) - sum(W_ls[i:]))) diff_min min(diff_min, abs(sum(W_ls[:i]) - sum(W_ls[i:]))) min diff_min abs(sum(W_ls[:i]) - sum(W_ls[i:])) abs sum(W_ls[:i]) - sum(W_ls[i:]) sum(W_ls[:i]) sum W_ls[:i] W_ls :i i sum(W_ls[i:]) sum W_ls[i:] W_ls i: i print(diff_min) print diff_min diff_min = sum(W_ls) sum(W_ls) diff_min W_ls = list(map(int, input().split(' '))) list(map(int, input().split(' '))) W_ls diff_min = min(diff_min, abs(sum(W_ls[:i]) - sum(W_ls[i:]))) min(diff_min, abs(sum(W_ls[:i]) - sum(W_ls[i:]))) diff_min N = int(input()) int(input()) N
N = int(input())
W_ls = list(map(int, input().split(' ')))
diff_min = sum(W_ls)
for i in range(len(W_ls)):
    diff_min = min(diff_min, abs(sum(W_ls[:i]) - sum(W_ls[i:])))
print(diff_min)