s = eval(input())



ans = 0

n = len(s) - 1

for i in range(2 ** n):

    op = [''] * n

    for j in range(n):

        if ((i >> j) & 1):

            op[n - j - 1] = '+'

    formula = ''

    for p_n, p_o in zip(s,op+['']):

        formula += (p_n+p_o)

    ans += eval(formula)



print(ans)

s = eval(input())



ans = 0

n = len(s)

for i in range(2 ** (n-1)):

    t = 0

    for j in range(n):

        t *= 10

        t += int(s[j])

        

        if ((i >> j) & 1):

            ans += t

            t = 0

    ans += t



print(ans)

s = eval(input())
ans = 0
n = len(s) - 1
for i in range(2**n):
    op = [""] * n
    for j in range(n):
        if (i >> j) & 1:
            op[n - j - 1] = "+"
    formula = ""
    for p_n, p_o in zip(s, op + [""]):
        formula += p_n + p_o
    ans += eval(formula)
print(ans)

s = eval(input())
ans = 0
n = len(s)
for i in range(2 ** (n - 1)):
    t = 0
    for j in range(n):
        t *= 10
        t += int(s[j])
        if (i >> j) & 1:
            ans += t
            t = 0
    ans += t
print(ans)

-n = len(s) - 1 -for i in range(2**n): -    op = [""] * n +n = len(s) +for i in range(2 ** (n - 1)): +    t = 0 +        t *= 10 +        t += int(s[j]) -            op[n - j - 1] = "+" -    formula = "" -    for p_n, p_o in zip(s, op + [""]): -        formula += p_n + p_o -    ans += eval(formula) +            ans += t +            t = 0 +    ans += t