n = int(input())
w = list(map(int, input().split()))
res = 10 ** 9 + 7
for t in range(n - 1):
    u = sum(w[:t + 1])
    l = sum(w[t + 1:])
    dif = abs(u - l)
    if dif < res:
        res = dif
print(res) 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 res = 10 ** 9 + 7 res 10 ** 9 + 7 10 ** 9 10 9 7 for t in range(n - 1):
    u = sum(w[:t + 1])
    l = sum(w[t + 1:])
    dif = abs(u - l)
    if dif < res:
        res = dif t range(n - 1) range n - 1 n 1 u = sum(w[:t + 1]) u sum(w[:t + 1]) sum w[:t + 1] w :t + 1 t + 1 t 1 l = sum(w[t + 1:]) l sum(w[t + 1:]) sum w[t + 1:] w t + 1: t + 1 t 1 dif = abs(u - l) dif abs(u - l) abs u - l u l if dif < res:
        res = dif dif < res dif res res = dif res dif print(res) print res u = sum(w[:t + 1]) sum(w[:t + 1]) u res = dif dif res l = sum(w[t + 1:]) sum(w[t + 1:]) l dif = abs(u - l) abs(u - l) dif n = int(input()) int(input()) n w = list(map(int, input().split())) list(map(int, input().split())) w res = 10 ** 9 + 7 10 ** 9 + 7 res
n = int(input())
w = list(map(int, input().split()))
res = 10 ** 9 + 7
for t in range(n - 1):
    u = sum(w[:t + 1])
    l = sum(w[t + 1:])
    dif = abs(u - l)
    if dif < res:
        res = dif
print(res)
