n = int(input())
w = list(map(int,input().split()))
zentai = sum(w)
ans = sum(w)
suteta = 0

for i in range(n):
    zentai -= w[i]
    suteta += w[i]
    ans = min(ans,abs(zentai-suteta))

print(ans) 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 zentai = sum(w) zentai sum(w) sum w ans = sum(w) ans sum(w) sum w suteta = 0 suteta 0 for i in range(n):
    zentai -= w[i]
    suteta += w[i]
    ans = min(ans,abs(zentai-suteta)) i range(n) range n zentai -= w[i] zentai w[i] w i suteta += w[i] suteta w[i] w i ans = min(ans,abs(zentai-suteta)) ans min(ans,abs(zentai-suteta)) min ans abs(zentai-suteta) abs zentai-suteta zentai suteta print(ans) print ans suteta = 0 0 suteta ans = sum(w) sum(w) ans ans = min(ans,abs(zentai-suteta)) min(ans,abs(zentai-suteta)) ans zentai = sum(w) sum(w) zentai zentai -= w[i] w[i] zentai suteta += w[i] w[i] suteta n = int(input()) int(input()) n w = list(map(int,input().split())) list(map(int,input().split())) w
n = int(input())
w = list(map(int,input().split()))
zentai = sum(w)
ans = sum(w)
suteta = 0

for i in range(n):
    zentai -= w[i]
    suteta += w[i]
    ans = min(ans,abs(zentai-suteta))

print(ans)