n = int(input())
w = [int(s) for s in input().split()]

acc = [sum(w[:x]) for x in range(1, n + 1)]
center = acc[n - 1] / 2
index = 0

for i in range(n):
    if acc[i] >= center:
        if abs(center - acc[i]) < abs(center - acc[i - 1]):
            index = i
        else:
            index = i - 1
        break
print(abs((acc[n - 1] - acc[index]) - acc[index])) n = int(input()) n int(input()) int input() input int(s) for s in input().split() for s in input().split() s input().split() ().split () input split for s in input().split() int(s) int s w = [int(s) for s in input().split()] w [int(s) for s in input().split()] sum(w[:x]) for x in range(1, n + 1) for x in range(1, n + 1) x range(1, n + 1) range 1 n + 1 n 1 for x in range(1, n + 1) sum(w[:x]) sum w[:x] w :x x acc = [sum(w[:x]) for x in range(1, n + 1)] acc [sum(w[:x]) for x in range(1, n + 1)] center = acc[n - 1] / 2 center acc[n - 1] / 2 acc[n - 1] acc n - 1 n 1 2 index = 0 index 0 for i in range(n):
    if acc[i] >= center:
        if abs(center - acc[i]) < abs(center - acc[i - 1]):
            index = i
        else:
            index = i - 1
        break i range(n) range n if acc[i] >= center:
        if abs(center - acc[i]) < abs(center - acc[i - 1]):
            index = i
        else:
            index = i - 1
        break acc[i] >= center acc[i] acc i center if abs(center - acc[i]) < abs(center - acc[i - 1]):
            index = i
        else:
            index = i - 1
         abs(center - acc[i]) < abs(center - acc[i - 1]) abs(center - acc[i]) abs center - acc[i] center acc[i] acc i abs(center - acc[i - 1]) abs center - acc[i - 1] center acc[i - 1] acc i - 1 i 1 index = i index i index = i - 1 index i - 1 i 1 break print(abs((acc[n - 1] - acc[index]) - acc[index])) print abs((acc[n - 1] - acc[index]) - acc[index]) abs (acc[n - 1] - acc[index]) - acc[index] acc[n - 1] - acc[index] acc[n - 1] acc n - 1 n 1 acc[index] acc index acc[index] acc index index = 0 0 index w = [int(s) for s in input().split()] [int(s) for s in input().split()] w acc = [sum(w[:x]) for x in range(1, n + 1)] [sum(w[:x]) for x in range(1, n + 1)] acc index = i i index center = acc[n - 1] / 2 acc[n - 1] / 2 center n = int(input()) int(input()) n index = i - 1 i - 1 index
n = int(input())
w = [int(s) for s in input().split()]

acc = [sum(w[:x]) for x in range(1, n + 1)]
center = acc[n - 1] / 2
index = 0

for i in range(n):
    if acc[i] >= center:
        if abs(center - acc[i]) < abs(center - acc[i - 1]):
            index = i
        else:
            index = i - 1
        break
print(abs((acc[n - 1] - acc[index]) - acc[index]))