number = input()
first_number_list = []
second_number_list = []
multiply = 1
for n in number:
n = int(n)
first_number_list.append(n)
if len(first_number_list) != 8:
quit()
else:
for num in first_number_list:
if num > 2:
second_number_list.append(num)
for idk in second_number_list:
multiply = multiply * idk
print(multiply)
number = input()
first_number_list = []
second_number_list = []
multiply = 1
for n in number:
n = int(n)
first_number_list.append(n)
if len(first_number_list) != 8:
quit()
else:
for num in first_number_list:
if num > 2:
second_number_list.append(num)
for idk in second_number_list:
multiply = multiply * idk
print(multiply)