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