<reponame>hythof/atc<gh_stars>0
n,*a = [int(x) for x in open(0).read().split()]
l=0
r=sum(a)
ans=float('inf')
for ai in a[:-1]:
    l+=ai
    r-=ai
    ans=min(ans,abs(l-r))
print(ans)

n,*a = [int(x) for x in open(0).read().split()]
l=0
r=sum(a)
ans=float('inf')
for ai in a[:-1]:
    l+=ai
    r-=ai
    ans=min(ans,abs(l-r))
print(ans)