num = input()
summ = 0
prod = 1
while len(num) != 0:
n = int(num[-1])
num = num[:-1]
summ += n
prod *= n
print(summ)
print(prod)
num = input()
summ = 0
prod = 1
while len(num) != 0:
n = int(num[-1])
num = num[:-1]
summ += n
prod *= n
print(summ)
print(prod)