s = eval(input())

ans = 0

n = len(s) - 1

m = 2 ** n

for i in range(m):

    bit = bin(i)[2:len(bin(i))]

    a = n - len(bit)

    if a != 0:

        bit = '0'*a + bit

    tmp = int(s[0])

    for j in range(n):

        if bit[j] == '0':

            tmp = 10*tmp + int(s[j+1])

        elif bit[j] == '1':

            ans += tmp

            tmp = int(s[j+1])

    ans += tmp

print(ans)

s = eval(input())

n = len(s)

def dfs(i, l):

    if i == n-1:

        return sum(list(map(int, l.split("+"))))

    return dfs(i+1, l+s[i+1]) + dfs(i+1, l+"+"+s[i+1])



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

s = eval(input())
ans = 0
n = len(s) - 1
m = 2**n
for i in range(m):
    bit = bin(i)[2 : len(bin(i))]
    a = n - len(bit)
    if a != 0:
        bit = "0" * a + bit
    tmp = int(s[0])
    for j in range(n):
        if bit[j] == "0":
            tmp = 10 * tmp + int(s[j + 1])
        elif bit[j] == "1":
            ans += tmp
            tmp = int(s[j + 1])
    ans += tmp
print(ans)

s = eval(input())
n = len(s)


def dfs(i, l):
    if i == n - 1:
        return sum(list(map(int, l.split("+"))))
    return dfs(i + 1, l + s[i + 1]) + dfs(i + 1, l + "+" + s[i + 1])


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

-ans = 0 -n = len(s) - 1 -m = 2**n -for i in range(m): -    bit = bin(i)[2 : len(bin(i))] -    a = n - len(bit) -    if a != 0: -        bit = "0" * a + bit -    tmp = int(s[0]) -    for j in range(n): -        if bit[j] == "0": -            tmp = 10 * tmp + int(s[j + 1]) -        elif bit[j] == "1": -            ans += tmp -            tmp = int(s[j + 1]) -    ans += tmp -print(ans) +n = len(s) + + +def dfs(i, l): +    if i == n - 1: +        return sum(list(map(int, l.split("+")))) +    return dfs(i + 1, l + s[i + 1]) + dfs(i + 1, l + "+" + s[i + 1]) + + +print((dfs(0, s[0])))