S = eval(input())

num = len(S) - 1

sum = 0



for i in range(2**num):

  op = [''] * (num+1)

  formula = ''

  for j in range(num):

    if ((i >> j) & 1):

      op[j] = '+'

  for a,b in zip(S,op):

    formula += a + b

  sum += eval(formula)



print(sum)
S = eval(input())

num = len(S) - 1

sum = 0



for i in range(2**num):

  k = 0

  for j in range(num):

    if ((i >> j) & 1):

      sum += int(S[k:j+1])

      k = j + 1

  sum += int(S[k:])



print(sum)
S = eval(input())
num = len(S) - 1
sum = 0
for i in range(2**num):
    op = [""] * (num + 1)
    formula = ""
    for j in range(num):
        if (i >> j) & 1:
            op[j] = "+"
    for a, b in zip(S, op):
        formula += a + b
    sum += eval(formula)
print(sum)

S = eval(input())
num = len(S) - 1
sum = 0
for i in range(2**num):
    k = 0
    for j in range(num):
        if (i >> j) & 1:
            sum += int(S[k : j + 1])
            k = j + 1
    sum += int(S[k:])
print(sum)

-    op = [""] * (num + 1) -    formula = "" +    k = 0 -            op[j] = "+" -    for a, b in zip(S, op): -        formula += a + b -    sum += eval(formula) +            sum += int(S[k : j + 1]) +            k = j + 1 +    sum += int(S[k:])