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