s=eval(input())

l=len(s)



def dfs(i,f):

    if i==l-1:

        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=eval(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)
s = eval(input())
l = len(s)


def dfs(i, f):
    if i == l - 1:
        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 = eval(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)

+from itertools import product - -def dfs(i, f): -    if i == l - 1: -        return eval(f) -    else: -        return dfs(i + 1, f + s[i + 1]) + dfs(i + 1, f + "+" + s[i + 1]) - - -print((dfs(0, s[0]))) +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)