import itertools

s=eval(input())

length=len(s)



ans=0

mylist=list(itertools.product('01',repeat=length-1))



for j in range(len(mylist)):

    tmp=s[0]

    for i in range(length-1):

        if mylist[j][i]=='1':

            tmp+="+"+s[i+1]

        else:

            tmp+=s[i+1]

    tmp=eval(tmp)

    ans+=tmp

print(ans)

n=eval(input())

anslist=[]



def saiki(n,x,a,k):

    if k==len(n):

        anslist.append(eval(x))

        return

    else:

        for i in a:

            y=x

            x=x+i+n[k]

            saiki(n,x,a,k+1)

            x=y       



saiki(n,n[0],['','+'],1)

print((sum(anslist)))
import itertools

s = eval(input())
length = len(s)
ans = 0
mylist = list(itertools.product("01", repeat=length - 1))
for j in range(len(mylist)):
    tmp = s[0]
    for i in range(length - 1):
        if mylist[j][i] == "1":
            tmp += "+" + s[i + 1]
        else:
            tmp += s[i + 1]
    tmp = eval(tmp)
    ans += tmp
print(ans)

n = eval(input())
anslist = []


def saiki(n, x, a, k):
    if k == len(n):
        anslist.append(eval(x))
        return
    else:
        for i in a:
            y = x
            x = x + i + n[k]
            saiki(n, x, a, k + 1)
            x = y


saiki(n, n[0], ["", "+"], 1)
print((sum(anslist)))

-import itertools +n = eval(input()) +anslist = [] -s = eval(input()) -length = len(s) -ans = 0 -mylist = list(itertools.product("01", repeat=length - 1)) -for j in range(len(mylist)): -    tmp = s[0] -    for i in range(length - 1): -        if mylist[j][i] == "1": -            tmp += "+" + s[i + 1] -        else: -            tmp += s[i + 1] -    tmp = eval(tmp) -    ans += tmp -print(ans) + +def saiki(n, x, a, k): +    if k == len(n): +        anslist.append(eval(x)) +        return +    else: +        for i in a: +            y = x +            x = x + i + n[k] +            saiki(n, x, a, k + 1) +            x = y + + +saiki(n, n[0], ["", "+"], 1) +print((sum(anslist)))