import itertools as it



S = eval(input())

ans = 0

for config in it.product(list(range(2)), repeat=len(S) - 1):

    eq = ""

    for i in range(len(S) - 1):

        eq += S[i] + "+" if config[i] == 1 else S[i]

    eq += S[-1]

    ans += sum([int(i) for i in eq.split("+")])

print(ans)

import itertools as it



S = eval(input())

ans = 0

for config in it.product(["+", ""], repeat=len(S) - 1):

    num = []

    for i in range(len(S)):

        num.append(S[i])

        if i < len(S) - 1:

            num.append(config[i])

    ans += sum([int(i) for i in "".join(num).split("+")])

print(ans)

import itertools as it

S = eval(input())
ans = 0
for config in it.product(list(range(2)), repeat=len(S) - 1):
    eq = ""
    for i in range(len(S) - 1):
        eq += S[i] + "+" if config[i] == 1 else S[i]
    eq += S[-1]
    ans += sum([int(i) for i in eq.split("+")])
print(ans)

import itertools as it

S = eval(input())
ans = 0
for config in it.product(["+", ""], repeat=len(S) - 1):
    num = []
    for i in range(len(S)):
        num.append(S[i])
        if i < len(S) - 1:
            num.append(config[i])
    ans += sum([int(i) for i in "".join(num).split("+")])
print(ans)

-for config in it.product(list(range(2)), repeat=len(S) - 1): -    eq = "" -    for i in range(len(S) - 1): -        eq += S[i] + "+" if config[i] == 1 else S[i] -    eq += S[-1] -    ans += sum([int(i) for i in eq.split("+")]) +for config in it.product(["+", ""], repeat=len(S) - 1): +    num = [] +    for i in range(len(S)): +        num.append(S[i]) +        if i < len(S) - 1: +            num.append(config[i]) +    ans += sum([int(i) for i in "".join(num).split("+")])