N = int(input())
WL = list(map(int, input().split()))
Aw = sum(WL)
Ow = 0
AL = []
for i in range(N):
    Ow += WL[i]
    ans = abs(Ow - (Aw -Ow))
    AL.append(ans)
print(min(AL)) N = int(input()) N int(input()) int input() input WL = list(map(int, input().split())) WL list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split Aw = sum(WL) Aw sum(WL) sum WL Ow = 0 Ow 0 AL = [] AL [] for i in range(N):
    Ow += WL[i]
    ans = abs(Ow - (Aw -Ow))
    AL.append(ans) i range(N) range N Ow += WL[i] Ow WL[i] WL i ans = abs(Ow - (Aw -Ow)) ans abs(Ow - (Aw -Ow)) abs Ow - (Aw -Ow) Ow Aw -Ow Aw Ow AL.append(ans) AL.append AL append ans print(min(AL)) print min(AL) min AL Ow = 0 0 Ow N = int(input()) int(input()) N WL = list(map(int, input().split())) list(map(int, input().split())) WL Ow += WL[i] WL[i] Ow Aw = sum(WL) sum(WL) Aw AL = [] [] AL ans = abs(Ow - (Aw -Ow)) abs(Ow - (Aw -Ow)) ans
N = int(input())
WL = list(map(int, input().split()))
Aw = sum(WL)
Ow = 0
AL = []
for i in range(N):
    Ow += WL[i]
    ans = abs(Ow - (Aw -Ow))
    AL.append(ans)
print(min(AL))