from itertools import product



a=list(eval(input()))

sum=0

text=""

for i in product(["","+"],repeat=len(a)-1):

    text=""

    for j in range(len(a)-1):

        text+=a[j]+i[j]

    text+=a[len(a)-1]

    sum+=eval(text)

print(sum)

        
from itertools import product



s = str(eval(input()))

a = list(product(['+', ''], repeat=len(s)-1))





ans = 0

tmp = ""

for i in a:

    tmp = ""

    for j in range(len(s)-1):

        tmp += (s[j]+i[j])

    tmp += s[len(s)-1]

    ans += eval(tmp)

print(ans)

from itertools import product

a = list(eval(input()))
sum = 0
text = ""
for i in product(["", "+"], repeat=len(a) - 1):
    text = ""
    for j in range(len(a) - 1):
        text += a[j] + i[j]
    text += a[len(a) - 1]
    sum += eval(text)
print(sum)

from itertools import product

s = str(eval(input()))
a = list(product(["+", ""], repeat=len(s) - 1))
ans = 0
tmp = ""
for i in a:
    tmp = ""
    for j in range(len(s) - 1):
        tmp += s[j] + i[j]
    tmp += s[len(s) - 1]
    ans += eval(tmp)
print(ans)

-a = list(eval(input())) -sum = 0 -text = "" -for i in product(["", "+"], repeat=len(a) - 1): -    text = "" -    for j in range(len(a) - 1): -        text += a[j] + i[j] -    text += a[len(a) - 1] -    sum += eval(text) -print(sum) +s = str(eval(input())) +a = list(product(["+", ""], repeat=len(s) - 1)) +ans = 0 +tmp = "" +for i in a: +    tmp = "" +    for j in range(len(s) - 1): +        tmp += s[j] + i[j] +    tmp += s[len(s) - 1] +    ans += eval(tmp) +print(ans)