mas = list(map(int,input().split()))
s = 0
for i in range(len(mas)):
if mas[i] > 0:
s += mas[i]
print(s)
mas = list(map(int,input().split()))
s = 0
for i in range(len(mas)):
if mas[i] > 0:
s += mas[i]
print(s)