n = int(input())
w = list(map(int, input().split()))

total = sum(w)
dif = 10**5
point = 0

for i in w:
    point += i
    if abs(total-2*point) < dif:
        dif = abs(total-2*point)
    else:
        continue
print(dif) 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 total = sum(w) total sum(w) sum w dif = 10**5 dif 10**5 10 5 point = 0 point 0 for i in w:
    point += i
    if abs(total-2*point) < dif:
        dif = abs(total-2*point)
    else:
        continue i w point += i point i if abs(total-2*point) < dif:
        dif = abs(total-2*point)
    else:
        continue abs(total-2*point) < dif abs(total-2*point) abs total-2*point total 2*point 2 point dif dif = abs(total-2*point) dif abs(total-2*point) abs total-2*point total 2*point 2 point continue print(dif) print dif point += i i point w = list(map(int, input().split())) list(map(int, input().split())) w n = int(input()) int(input()) n dif = abs(total-2*point) abs(total-2*point) dif total = sum(w) sum(w) total point = 0 0 point dif = 10**5 10**5 dif
n = int(input())
w = list(map(int, input().split()))

total = sum(w)
dif = 10**5
point = 0

for i in w:
    point += i
    if abs(total-2*point) < dif:
        dif = abs(total-2*point)
    else:
        continue
print(dif)