from itertools import product

S = input().strip()

N = len(S)

cnt = 0

for x in product((0,1),repeat=N-1):

    y = S[0]

    for i in range(N-1):

        if x[i]==1:

            y += "+"

        y += S[i+1]

    cnt += eval(y)

print(cnt)
from itertools import product

S = input().strip()

N = len(S)

cnt = 0

for x in product((0,1),repeat=N-1):

    y = ""

    for i in range(N-1):

        y += S[i]

        if x[i]==1:

            y += "+"

    y += S[N-1]

    cnt += eval(y)

print(cnt)
from itertools import product

S = input().strip()
N = len(S)
cnt = 0
for x in product((0, 1), repeat=N - 1):
    y = S[0]
    for i in range(N - 1):
        if x[i] == 1:
            y += "+"
        y += S[i + 1]
    cnt += eval(y)
print(cnt)

from itertools import product

S = input().strip()
N = len(S)
cnt = 0
for x in product((0, 1), repeat=N - 1):
    y = ""
    for i in range(N - 1):
        y += S[i]
        if x[i] == 1:
            y += "+"
    y += S[N - 1]
    cnt += eval(y)
print(cnt)

-    y = S[0] +    y = "" +        y += S[i] -        y += S[i + 1] +    y += S[N - 1]