You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion.  All strings that can be obtained in this way can be evaluated as formulas.  Evaluate all possible formulas, and print the sum of the results.
s=input()
l=len(s)

def dfs(i,f):
    if i==l-1:
        print(f)
        return eval(f)
    else:
        return dfs(i+1, f+s[i+1]) + dfs(i+1,f+'+'+s[i+1])

print(dfs(0,s[0]))
s=input()
l=len(s)

from itertools import product
bits=list(product([0,1], repeat=l-1))

ans=0
for bit in bits:
    tmp_s=s
    cnt=0
    for i in range(l-1):
        if bit[i]==1:
            tmp_s=tmp_s[:i+1+cnt]+'+'+tmp_s[i+1+cnt:]
            cnt+=1
    ans+=eval(tmp_s)

print(ans)