S = list(eval(input()))

ls = len(S)

n = ls - 1

ans = 0

from copy import deepcopy

for i in range(2 ** n):

    siki = deepcopy(S)

    add = 1

    for j in range(n):

        if ((i >> j) & 1):

            siki.insert(j+add, "+")

            add += 1

    # print("".join(siki))

    ans += eval("".join(siki))

print(ans)

S = eval(input())

n = len(S)-1

ans = 0

for i in range(2**n):

    add = 1

    expr = list(S)

    for j in range(n):

        if ((i >> j) & 1):

            expr.insert(j+add, "+")

            add += 1

    ans += eval("".join(expr))

print(ans)

S = list(eval(input()))
ls = len(S)
n = ls - 1
ans = 0
from copy import deepcopy

for i in range(2**n):
    siki = deepcopy(S)
    add = 1
    for j in range(n):
        if (i >> j) & 1:
            siki.insert(j + add, "+")
            add += 1
    # print("".join(siki))
    ans += eval("".join(siki))
print(ans)

S = eval(input())
n = len(S) - 1
ans = 0
for i in range(2**n):
    add = 1
    expr = list(S)
    for j in range(n):
        if (i >> j) & 1:
            expr.insert(j + add, "+")
            add += 1
    ans += eval("".join(expr))
print(ans)

-S = list(eval(input())) -ls = len(S) -n = ls - 1 +S = eval(input()) +n = len(S) - 1 -from copy import deepcopy - -    siki = deepcopy(S) +    expr = list(S) -            siki.insert(j + add, "+") +            expr.insert(j + add, "+") -    # print("".join(siki)) -    ans += eval("".join(siki)) +    ans += eval("".join(expr))