N = int(input())
w = list(map(int, input().split()))
val0, val1 = 0, sum(w)
diff = val1

for i in range(N):
    val0 += w[i]
    val1 -= w[i]
    if diff <= abs(val1 - val0):
        print(diff)
        break
    else:
        diff = abs(val1 - val0) 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 val0, val1 = 0, sum(w) val0 0 val1 sum(w) sum w diff = val1 diff val1 for i in range(N):
    val0 += w[i]
    val1 -= w[i]
    if diff <= abs(val1 - val0):
        print(diff)
        break
    else:
        diff = abs(val1 - val0) i range(N) range N val0 += w[i] val0 w[i] w i val1 -= w[i] val1 w[i] w i if diff <= abs(val1 - val0):
        print(diff)
        break
    else:
        diff = abs(val1 - val0) diff <= abs(val1 - val0) diff abs(val1 - val0) abs val1 - val0 val1 val0 print(diff) print diff break diff = abs(val1 - val0) diff abs(val1 - val0) abs val1 - val0 val1 val0 diff = abs(val1 - val0) abs(val1 - val0) diff w = list(map(int, input().split())) list(map(int, input().split())) w diff = val1 val1 diff N = int(input()) int(input()) N val1 = 0, sum(w) sum(w) val1 val1 -= w[i] w[i] val1 val0 += w[i] w[i] val0 val0, val1 = 0, sum(w) 0 val0
N = int(input())
w = list(map(int, input().split()))
val0, val1 = 0, sum(w)
diff = val1

for i in range(N):
    val0 += w[i]
    val1 -= w[i]
    if diff <= abs(val1 - val0):
        print(diff)
        break
    else:
        diff = abs(val1 - val0)
