from copy import deepcopy

N=list(eval(input()))

lenn=len(N)-1

cnt=0

for i in range(2**lenn):

    n=deepcopy(N)

    b=(("0"*lenn)+bin(i)[2:])[-lenn:]

    for i in range(lenn-1,-1,-1):

        if b[i]=="1":

            n.insert(i+1,"+")

    cnt+=eval("".join(n))

print(cnt)
a=eval(input())

l=len(a)

ans=0



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

    i=("0"*l+bin(i)[2:])[-l+1:]

    cnt=a[0]

    for j in range(l-1):

        if i[j]=="0":

            cnt+=a[j+1]

        else:

            ans+=int(cnt)

            if j<l-1:

                cnt=a[j+1]

            else:

                cnt=""

    if cnt!="":

        ans+=int(cnt)

print(ans)
from copy import deepcopy

N = list(eval(input()))
lenn = len(N) - 1
cnt = 0
for i in range(2**lenn):
    n = deepcopy(N)
    b = (("0" * lenn) + bin(i)[2:])[-lenn:]
    for i in range(lenn - 1, -1, -1):
        if b[i] == "1":
            n.insert(i + 1, "+")
    cnt += eval("".join(n))
print(cnt)

a = eval(input())
l = len(a)
ans = 0
for i in range(2 ** (l - 1)):
    i = ("0" * l + bin(i)[2:])[-l + 1 :]
    cnt = a[0]
    for j in range(l - 1):
        if i[j] == "0":
            cnt += a[j + 1]
        else:
            ans += int(cnt)
            if j < l - 1:
                cnt = a[j + 1]
            else:
                cnt = ""
    if cnt != "":
        ans += int(cnt)
print(ans)

-from copy import deepcopy - -N = list(eval(input())) -lenn = len(N) - 1 -cnt = 0 -for i in range(2**lenn): -    n = deepcopy(N) -    b = (("0" * lenn) + bin(i)[2:])[-lenn:] -    for i in range(lenn - 1, -1, -1): -        if b[i] == "1": -            n.insert(i + 1, "+") -    cnt += eval("".join(n)) -print(cnt) +a = eval(input()) +l = len(a) +ans = 0 +for i in range(2 ** (l - 1)): +    i = ("0" * l + bin(i)[2:])[-l + 1 :] +    cnt = a[0] +    for j in range(l - 1): +        if i[j] == "0": +            cnt += a[j + 1] +        else: +            ans += int(cnt) +            if j < l - 1: +                cnt = a[j + 1] +            else: +                cnt = "" +    if cnt != "": +        ans += int(cnt) +print(ans)