N = int(input())
W = list(map(int, input().split()))

minw = sum(W)

for t in range(N):
    s1 = sum(W[:t])
    s2 = sum(W[t:])
    diff = abs(s1 - s2)
    minw = min(minw, diff)

print(minw) 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 minw = sum(W) minw sum(W) sum W for t in range(N):
    s1 = sum(W[:t])
    s2 = sum(W[t:])
    diff = abs(s1 - s2)
    minw = min(minw, diff) t range(N) range N s1 = sum(W[:t]) s1 sum(W[:t]) sum W[:t] W :t t s2 = sum(W[t:]) s2 sum(W[t:]) sum W[t:] W t: t diff = abs(s1 - s2) diff abs(s1 - s2) abs s1 - s2 s1 s2 minw = min(minw, diff) minw min(minw, diff) min minw diff print(minw) print minw W = list(map(int, input().split())) list(map(int, input().split())) W s1 = sum(W[:t]) sum(W[:t]) s1 minw = sum(W) sum(W) minw N = int(input()) int(input()) N minw = min(minw, diff) min(minw, diff) minw diff = abs(s1 - s2) abs(s1 - s2) diff s2 = sum(W[t:]) sum(W[t:]) s2
N = int(input())
W = list(map(int, input().split()))

minw = sum(W)

for t in range(N):
    s1 = sum(W[:t])
    s2 = sum(W[t:])
    diff = abs(s1 - s2)
    minw = min(minw, diff)

print(minw)
