n = int(input())
w = [int(i) for i in input().split()]
ans = float('inf')
for i in range(n - 1):
    ans = min(ans, abs(sum(w[:i + 1]) - sum(w[i + 1:])))
print(ans) n = int(input()) n int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i w = [int(i) for i in input().split()] w [int(i) for i in input().split()] ans = float('inf') ans float('inf') float 'inf' for i in range(n - 1):
    ans = min(ans, abs(sum(w[:i + 1]) - sum(w[i + 1:]))) i range(n - 1) range n - 1 n 1 ans = min(ans, abs(sum(w[:i + 1]) - sum(w[i + 1:]))) ans min(ans, abs(sum(w[:i + 1]) - sum(w[i + 1:]))) min ans abs(sum(w[:i + 1]) - sum(w[i + 1:])) abs sum(w[:i + 1]) - sum(w[i + 1:]) sum(w[:i + 1]) sum w[:i + 1] w :i + 1 i + 1 i 1 sum(w[i + 1:]) sum w[i + 1:] w i + 1: i + 1 i 1 print(ans) print ans ans = float('inf') float('inf') ans w = [int(i) for i in input().split()] [int(i) for i in input().split()] w n = int(input()) int(input()) n ans = min(ans, abs(sum(w[:i + 1]) - sum(w[i + 1:]))) min(ans, abs(sum(w[:i + 1]) - sum(w[i + 1:]))) ans
n = int(input())
w = [int(i) for i in input().split()]
ans = float('inf')
for i in range(n - 1):
    ans = min(ans, abs(sum(w[:i + 1]) - sum(w[i + 1:])))
print(ans)