import itertools

s = str(eval(input()))



s4  = []

for l in range(2 ** (len(s)-1)):

    s3 = list(s)

    h = 0

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

        if (l >> i) & 1:

            s3.insert(i+h+1,'+')

            h += 1

    s4.append(s3)

print((sum([eval(''.join(i)) for i in s4])))
s = input()

n = len(s)



def dfs(i, f):

    if i == n - 1:

        return eval(f)



    return dfs(i+1, f + s[i+1]) + \

                dfs(i+1, f + '+' + s[i+1])

print(dfs(0,s[0]))

import itertools

s = str(eval(input()))
s4 = []
for l in range(2 ** (len(s) - 1)):
    s3 = list(s)
    h = 0
    for i in range(len(s) - 1):
        if (l >> i) & 1:
            s3.insert(i + h + 1, "+")
            h += 1
    s4.append(s3)
print((sum([eval("".join(i)) for i in s4])))

s = input()
n = len(s)


def dfs(i, f):
    if i == n - 1:
        return eval(f)
    return dfs(i + 1, f + s[i + 1]) + dfs(i + 1, f + "+" + s[i + 1])


print(dfs(0, s[0]))

-import itertools +s = input() +n = len(s) -s = str(eval(input())) -s4 = [] -for l in range(2 ** (len(s) - 1)): -    s3 = list(s) -    h = 0 -    for i in range(len(s) - 1): -        if (l >> i) & 1: -            s3.insert(i + h + 1, "+") -            h += 1 -    s4.append(s3) -print((sum([eval("".join(i)) for i in s4]))) + +def dfs(i, f): +    if i == n - 1: +        return eval(f) +    return dfs(i + 1, f + s[i + 1]) + dfs(i + 1, f + "+" + s[i + 1]) + + +print(dfs(0, s[0]))