x = list(input())
list1 = []
out = 0
if x == 1:
	out = 1
else:
	for i in x:
		list1.append(int(i))
	for i in range(len(list1)):
		out += (list1[i] ** len(list1))
print(out)

c99ac964eddc0cd1086c3f6e8e1ce356a0ba2948
<mask token>

<mask token>
if x == 1:
    out = 1
else:
    for i in x:
        list1.append(int(i))
    for i in range(len(list1)):
        out += list1[i] ** len(list1)
print(out)

x = list(input())
list1 = []
out = 0
if x == 1:
    out = 1
else:
    for i in x:
        list1.append(int(i))
    for i in range(len(list1)):
        out += list1[i] ** len(list1)
print(out)

x = list(input())
list1 = []
out = 0
if x == 1:
	out = 1
else:
	for i in x:
		list1.append(int(i))
	for i in range(len(list1)):
		out += (list1[i] ** len(list1))
print(out)
