s = eval(input())

n = len(s)

ans = 0



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

  form = s

  bit = []

  for _ in range(n-1):

    bit.append(i%2)

    i =  i//2



  for j in range(n-1):

    if bit[j]:

      form = form[:n-j-1] + '+' + form[n-j-1:]



    

  ans += eval(form)

print(ans)



s = eval(input())

n = len(s)

cand = []



def func(ac,yet,sum):

  next = int(yet[0])

  

  

  if len(yet) ==1:

    cand.append(sum+ ac+ next)

    cand.append(sum+ ac*10+ next)

  else:

    func(next, yet[1:],ac+sum)

    func(ac*10+next, yet[1:],sum)



func(0,s,0)

print((sum(cand)//2))
s = eval(input())
n = len(s)
ans = 0
for i in range(2 ** (n - 1)):
    form = s
    bit = []
    for _ in range(n - 1):
        bit.append(i % 2)
        i = i // 2
    for j in range(n - 1):
        if bit[j]:
            form = form[: n - j - 1] + "+" + form[n - j - 1 :]
    ans += eval(form)
print(ans)

s = eval(input())
n = len(s)
cand = []


def func(ac, yet, sum):
    next = int(yet[0])
    if len(yet) == 1:
        cand.append(sum + ac + next)
        cand.append(sum + ac * 10 + next)
    else:
        func(next, yet[1:], ac + sum)
        func(ac * 10 + next, yet[1:], sum)


func(0, s, 0)
print((sum(cand) // 2))

-ans = 0 -for i in range(2 ** (n - 1)): -    form = s -    bit = [] -    for _ in range(n - 1): -        bit.append(i % 2) -        i = i // 2 -    for j in range(n - 1): -        if bit[j]: -            form = form[: n - j - 1] + "+" + form[n - j - 1 :] -    ans += eval(form) -print(ans) +cand = [] + + +def func(ac, yet, sum): +    next = int(yet[0]) +    if len(yet) == 1: +        cand.append(sum + ac + next) +        cand.append(sum + ac * 10 + next) +    else: +        func(next, yet[1:], ac + sum) +        func(ac * 10 + next, yet[1:], sum) + + +func(0, s, 0) +print((sum(cand) // 2))