from itertools import product



S = eval(input())

N = len(S)

ans = 0

for opes in product(("", "+"), repeat=N - 1):

    eqn = []

    for s, o in zip(S[:-1], opes):

        eqn += s + o

    ans += eval("".join(eqn) + S[-1])

print(ans)



from itertools import product



S = eval(input())

N = len(S)

ans = 0

for opes in product(("", "+"), repeat=N - 1):

    eqn = []

    for s, o in zip(S[:-1], opes):

        eqn += s + o

    eqn = "".join(eqn) + S[-1]

    ans += sum(map(int, eqn.split("+")))

print(ans)



from itertools import product

S = eval(input())
N = len(S)
ans = 0
for opes in product(("", "+"), repeat=N - 1):
    eqn = []
    for s, o in zip(S[:-1], opes):
        eqn += s + o
    ans += eval("".join(eqn) + S[-1])
print(ans)

from itertools import product

S = eval(input())
N = len(S)
ans = 0
for opes in product(("", "+"), repeat=N - 1):
    eqn = []
    for s, o in zip(S[:-1], opes):
        eqn += s + o
    eqn = "".join(eqn) + S[-1]
    ans += sum(map(int, eqn.split("+")))
print(ans)

-    ans += eval("".join(eqn) + S[-1]) +    eqn = "".join(eqn) + S[-1] +    ans += sum(map(int, eqn.split("+")))