number = 1
number_list = []
while number != '0':
number = str(input())
number_list.append(number)
if number == '0':
number_list.remove(number)
break
even_numbers = []
for n in number_list:
if int(n) % 2 == 0:
even_numbers.append(int(n))
amount = 0
for i in even_numbers:
amount += i
print(amount)
number = 1
number_list = []
while number != '0':
number = str(input())
number_list.append(number)
if number == '0':
number_list.remove(number)
break
even_numbers = []
for n in number_list:
if int(n) % 2 == 0:
even_numbers.append(int(n))
amount = 0
for i in even_numbers:
amount += i
print(amount)