# coding=utf-8
N=int(input())
mylist=[]
i=1
while(i<=N):
    a=int(input())
    mylist.append(a)
    i=i+1
#print(mylist)
jihe=0
ji=0
ouhe=0
ou=1
while(ji<len(mylist)):
    jihe=jihe+mylist[ji]
    ji=ji+2
print(jihe)
while(ou<len(mylist)):
    ouhe=ouhe+mylist[ou]
    ou=ou+2
print(ouhe)
if(jihe>ouhe):
    print(jihe-ouhe)
else:
    print(ouhe-jihe)
/**************************************************************
	Problem: 2039
	User: admin
	Language: Python
	Result: Accepted
	Time:320 ms
	Memory:34480 kb
****************************************************************/