import itertools

import copy



S = list(eval(input()))



answer = 0

length = len(S)

for pattern in itertools.product((True, False), repeat=length-1):

    S2 = S[:]

    for i in range(length-1):

        if pattern[i]:

            S2.insert(length-i-1, '+')

    answer += eval(''.join(S2))



print(answer)
S = eval(input())

N = len(S)



def f(i, a):

    if i == N-1:

        return sum(list(map(int, a.split('+'))))

    

    return f(i+1, a + S[i+1]) + f(i+1, a + '+' + S[i+1])



print((f(0, S[0])))
import itertools
import copy

S = list(eval(input()))
answer = 0
length = len(S)
for pattern in itertools.product((True, False), repeat=length - 1):
    S2 = S[:]
    for i in range(length - 1):
        if pattern[i]:
            S2.insert(length - i - 1, "+")
    answer += eval("".join(S2))
print(answer)

S = eval(input())
N = len(S)


def f(i, a):
    if i == N - 1:
        return sum(list(map(int, a.split("+"))))
    return f(i + 1, a + S[i + 1]) + f(i + 1, a + "+" + S[i + 1])


print((f(0, S[0])))

-import itertools -import copy +S = eval(input()) +N = len(S) -S = list(eval(input())) -answer = 0 -length = len(S) -for pattern in itertools.product((True, False), repeat=length - 1): -    S2 = S[:] -    for i in range(length - 1): -        if pattern[i]: -            S2.insert(length - i - 1, "+") -    answer += eval("".join(S2)) -print(answer) + +def f(i, a): +    if i == N - 1: +        return sum(list(map(int, a.split("+")))) +    return f(i + 1, a + S[i + 1]) + f(i + 1, a + "+" + S[i + 1]) + + +print((f(0, S[0])))