n = int(input())
w = list(map(int, input().split()))
abs_diff = float('inf')
idx = 0
for i in range(n):
    if abs(sum(w[:i]) - sum(w[i:])) < abs_diff:
        abs_diff = abs(sum(w[:i]) - sum(w[i:]))
        idx = i
print(abs_diff) 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_diff = float('inf') abs_diff float('inf') float 'inf' idx = 0 idx 0 for i in range(n):
    if abs(sum(w[:i]) - sum(w[i:])) < abs_diff:
        abs_diff = abs(sum(w[:i]) - sum(w[i:]))
        idx = i i range(n) range n if abs(sum(w[:i]) - sum(w[i:])) < abs_diff:
        abs_diff = abs(sum(w[:i]) - sum(w[i:]))
        idx = i abs(sum(w[:i]) - sum(w[i:])) < abs_diff 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 abs_diff abs_diff = abs(sum(w[:i]) - sum(w[i:])) abs_diff 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 idx = i idx i print(abs_diff) print abs_diff idx = 0 0 idx w = list(map(int, input().split())) list(map(int, input().split())) w idx = i i idx abs_diff = abs(sum(w[:i]) - sum(w[i:])) abs(sum(w[:i]) - sum(w[i:])) abs_diff n = int(input()) int(input()) n abs_diff = float('inf') float('inf') abs_diff
n = int(input())
w = list(map(int, input().split()))
abs_diff = float('inf')
idx = 0
for i in range(n):
    if abs(sum(w[:i]) - sum(w[i:])) < abs_diff:
        abs_diff = abs(sum(w[:i]) - sum(w[i:]))
        idx = i
print(abs_diff)
