from itertools import*;*a,s=list(accumulate(list(map(int,open(0).read().split()[1:]))));print((min(abs(s-x*2)for x in a)))
from itertools import*;eval(input());*a,s=accumulate(list(map(int,input().split())));print((min(abs(s-x*2)for x in a)))
from itertools import *

*a, s = list(accumulate(list(map(int, open(0).read().split()[1:]))))
print((min(abs(s - x * 2) for x in a)))

from itertools import *

eval(input())
*a, s = accumulate(list(map(int, input().split())))
print((min(abs(s - x * 2) for x in a)))

-*a, s = list(accumulate(list(map(int, open(0).read().split()[1:])))) +eval(input()) +*a, s = accumulate(list(map(int, input().split())))