n = int(input())
l = list(map(int,input().split(" ")))
total = 0
for i in l:
    total += i

x = l[0]
y = total - x
a = abs(x - y)


for t in range(n):
    x = 0
    for i in range(t+1):
        x += l[i]
    y = total - x
    b = abs(x - y)
    if a > b:
        a = b

print(a) n = int(input()) n int(input()) int input() input l = list(map(int,input().split(" "))) l list(map(int,input().split(" "))) list map(int,input().split(" ")) map int input().split(" ") ().split () input split " " total = 0 total 0 for i in l:
    total += i i l total += i total i x = l[0] x l[0] l 0 y = total - x y total - x total x a = abs(x - y) a abs(x - y) abs x - y x y for t in range(n):
    x = 0
    for i in range(t+1):
        x += l[i]
    y = total - x
    b = abs(x - y)
    if a > b:
        a = b t range(n) range n x = 0 x 0 for i in range(t+1):
        x += l[i]
     i range(t+1) range t+1 t 1 x += l[i] x l[i] l i y = total - x y total - x total x b = abs(x - y) b abs(x - y) abs x - y x y if a > b:
        a = b a > b a b a = b a b print(a) print a a = abs(x - y) abs(x - y) a y = total - x total - x y x += l[i] l[i] x total = 0 0 total y = total - x total - x y l = list(map(int,input().split(" "))) list(map(int,input().split(" "))) l a = b b a b = abs(x - y) abs(x - y) b x = l[0] l[0] x n = int(input()) int(input()) n total += i i total x = 0 0 x
n = int(input())
l = list(map(int,input().split(" ")))
total = 0
for i in l:
    total += i

x = l[0]
y = total - x
a = abs(x - y)


for t in range(n):
    x = 0
    for i in range(t+1):
        x += l[i]
    y = total - x
    b = abs(x - y)
    if a > b:
        a = b

print(a)