N=int(input())
W=[int(x) for x in input().split()]
A=[abs(sum(W[:i])-sum(W[i:])) for i in range(1,N)]
print(min(A)) N=int(input()) N int(input()) int input() input int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x W=[int(x) for x in input().split()] W [int(x) for x in input().split()] abs(sum(W[:i])-sum(W[i:])) for i in range(1,N) for i in range(1,N) i range(1,N) range 1 N for i in range(1,N) 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 A=[abs(sum(W[:i])-sum(W[i:])) for i in range(1,N)] A [abs(sum(W[:i])-sum(W[i:])) for i in range(1,N)] print(min(A)) print min(A) min A N=int(input()) int(input()) N W=[int(x) for x in input().split()] [int(x) for x in input().split()] W A=[abs(sum(W[:i])-sum(W[i:])) for i in range(1,N)] [abs(sum(W[:i])-sum(W[i:])) for i in range(1,N)] A
N=int(input())
W=[int(x) for x in input().split()]
A=[abs(sum(W[:i])-sum(W[i:])) for i in range(1,N)]
print(min(A))
