from itertools import combinations_with_replacement, permutations, zip_longest

S = eval(input())

cmb = list(combinations_with_replacement(["", "+"], (len(S)-1)))

prm = set()

for c in cmb:

    for p in permutations(c):

        prm.add(p)



formulas = []

for p in prm:

    formulas.append("".join(x+y for x, y in zip_longest(S, p, fillvalue="")))



ans = 0

for f in formulas:

    ans += eval(f)

print(ans)





from itertools import product, zip_longest



S = eval(input())

cmb = list(product(["", "+"], repeat=(len(S) - 1)))



formulas = []

for c in cmb:

    formulas.append("".join(x + y for x, y in zip_longest(S, c, fillvalue="")))



ans = 0

for f in formulas:

    ans += eval(f)

print(ans)
from itertools import combinations_with_replacement, permutations, zip_longest

S = eval(input())
cmb = list(combinations_with_replacement(["", "+"], (len(S) - 1)))
prm = set()
for c in cmb:
    for p in permutations(c):
        prm.add(p)
formulas = []
for p in prm:
    formulas.append("".join(x + y for x, y in zip_longest(S, p, fillvalue="")))
ans = 0
for f in formulas:
    ans += eval(f)
print(ans)

from itertools import product, zip_longest

S = eval(input())
cmb = list(product(["", "+"], repeat=(len(S) - 1)))
formulas = []
for c in cmb:
    formulas.append("".join(x + y for x, y in zip_longest(S, c, fillvalue="")))
ans = 0
for f in formulas:
    ans += eval(f)
print(ans)

-from itertools import combinations_with_replacement, permutations, zip_longest +from itertools import product, zip_longest -cmb = list(combinations_with_replacement(["", "+"], (len(S) - 1))) -prm = set() +cmb = list(product(["", "+"], repeat=(len(S) - 1))) +formulas = [] -    for p in permutations(c): -        prm.add(p) -formulas = [] -for p in prm: -    formulas.append("".join(x + y for x, y in zip_longest(S, p, fillvalue=""))) +    formulas.append("".join(x + y for x, y in zip_longest(S, c, fillvalue="")))