n=int(input())
w=list(map(int,input().split()))
s_1=0
s_2=sum(w)
for i in range(n):
  if abs(s_2 - s_1) >= abs(s_2-s_1-2*w[i]):
    s_2 -= w[i]
    s_1 += w[i]
  else:
    break
print(abs(s_2-s_1)) 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 s_1=0 s_1 0 s_2=sum(w) s_2 sum(w) sum w for i in range(n):
  if abs(s_2 - s_1) >= abs(s_2-s_1-2*w[i]):
    s_2 -= w[i]
    s_1 += w[i]
  else:
    break i range(n) range n if abs(s_2 - s_1) >= abs(s_2-s_1-2*w[i]):
    s_2 -= w[i]
    s_1 += w[i]
  else:
    break abs(s_2 - s_1) >= abs(s_2-s_1-2*w[i]) abs(s_2 - s_1) abs s_2 - s_1 s_2 s_1 abs(s_2-s_1-2*w[i]) abs s_2-s_1-2*w[i] s_2-s_1 s_2 s_1 2*w[i] 2 w[i] w i s_2 -= w[i] s_2 w[i] w i s_1 += w[i] s_1 w[i] w i break print(abs(s_2-s_1)) print abs(s_2-s_1) abs s_2-s_1 s_2 s_1 n=int(input()) int(input()) n s_2=sum(w) sum(w) s_2 s_1 += w[i] w[i] s_1 s_2 -= w[i] w[i] s_2 w=list(map(int,input().split())) list(map(int,input().split())) w s_1=0 0 s_1
n=int(input())
w=list(map(int,input().split()))
s_1=0
s_2=sum(w)
for i in range(n):
  if abs(s_2 - s_1) >= abs(s_2-s_1-2*w[i]):
    s_2 -= w[i]
    s_1 += w[i]
  else:
    break
print(abs(s_2-s_1))