S=eval(input())

l=len(S)

ls=[i for i in range(1,l)]

    

import itertools as it

a=0

for i in range(l):

 for j in it.combinations(ls, i):

  t='';p=0

  for k in j:

    t+=S[p:k]+'+'

    p=k

  t+=S[p:]

  a+=eval(''.join(t))

print(a)
S=eval(input())

l=len(S)



import itertools as it

a=0

for i in range(l):

 for j in it.combinations(list(range(1,l)), i):

  t='';p=0

  for k in j:

    t+=S[p:k]+'+'

    p=k

  t+=S[p:]

  a+=eval(''.join(t))

print(a)
S = eval(input())
l = len(S)
ls = [i for i in range(1, l)]
import itertools as it

a = 0
for i in range(l):
    for j in it.combinations(ls, i):
        t = ""
        p = 0
        for k in j:
            t += S[p:k] + "+"
            p = k
        t += S[p:]
        a += eval("".join(t))
print(a)

S = eval(input())
l = len(S)
import itertools as it

a = 0
for i in range(l):
    for j in it.combinations(list(range(1, l)), i):
        t = ""
        p = 0
        for k in j:
            t += S[p:k] + "+"
            p = k
        t += S[p:]
        a += eval("".join(t))
print(a)

-ls = [i for i in range(1, l)] -    for j in it.combinations(ls, i): +    for j in it.combinations(list(range(1, l)), i):