N = int(input())
a = list(map(int,input().split()))

lst = [0]*(N-1)
x = [a[0]]*(N-1)
y = [sum(a)-a[0]]*(N-1)
lst[0] = abs(x[0]-y[0])

for i in range(1,N-1):
    x[i] = x[i-1]+a[i]
    y[i] = y[i-1]-a[i]
    lst[i] = abs(x[i]-y[i])

ans = min(lst)
print(ans) N = int(input()) N int(input()) int input() input a = list(map(int,input().split())) a list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split lst = [0]*(N-1) lst [0]*(N-1) [0] 0 N-1 N 1 x = [a[0]]*(N-1) x [a[0]]*(N-1) [a[0]] a[0] a 0 N-1 N 1 y = [sum(a)-a[0]]*(N-1) y [sum(a)-a[0]]*(N-1) [sum(a)-a[0]] sum(a)-a[0] sum(a) sum a a[0] a 0 N-1 N 1 lst[0] = abs(x[0]-y[0]) lst[0] lst 0 abs(x[0]-y[0]) abs x[0]-y[0] x[0] x 0 y[0] y 0 for i in range(1,N-1):
    x[i] = x[i-1]+a[i]
    y[i] = y[i-1]-a[i]
    lst[i] = abs(x[i]-y[i]) i range(1,N-1) range 1 N-1 N 1 x[i] = x[i-1]+a[i] x[i] x i x[i-1]+a[i] x[i-1] x i-1 i 1 a[i] a i y[i] = y[i-1]-a[i] y[i] y i y[i-1]-a[i] y[i-1] y i-1 i 1 a[i] a i lst[i] = abs(x[i]-y[i]) lst[i] lst i abs(x[i]-y[i]) abs x[i]-y[i] x[i] x i y[i] y i ans = min(lst) ans min(lst) min lst print(ans) print ans a = list(map(int,input().split())) list(map(int,input().split())) a x = [a[0]]*(N-1) [a[0]]*(N-1) x y = [sum(a)-a[0]]*(N-1) [sum(a)-a[0]]*(N-1) y lst = [0]*(N-1) [0]*(N-1) lst N = int(input()) int(input()) N ans = min(lst) min(lst) ans
N = int(input())
a = list(map(int,input().split()))

lst = [0]*(N-1)
x = [a[0]]*(N-1)
y = [sum(a)-a[0]]*(N-1)
lst[0] = abs(x[0]-y[0])

for i in range(1,N-1):
    x[i] = x[i-1]+a[i]
    y[i] = y[i-1]-a[i]
    lst[i] = abs(x[i]-y[i])

ans = min(lst)
print(ans)
