s = eval(input())

sum = 0



for bit in range(1<<(len(s)-1)):

  f = s[0]

  

  

  for i in range(len(s)-1):

    if bit & (1<<i):

      f += "+"

      

    f += s[i+1]

   

    

  sum += eval(f)

  

print(sum)
s = eval(input())





def dfs(i,f):

  if i == len(s)-1:

    return sum(list(map(int,f.split("+"))))

  

  return dfs(i+1,f+s[i+1]) + dfs(i+1,f+"+"+s[i+1])



print((dfs(0,s[0])))
s = eval(input())
sum = 0
for bit in range(1 << (len(s) - 1)):
    f = s[0]
    for i in range(len(s) - 1):
        if bit & (1 << i):
            f += "+"
        f += s[i + 1]
    sum += eval(f)
print(sum)

s = eval(input())


def dfs(i, f):
    if i == len(s) - 1:
        return sum(list(map(int, f.split("+"))))
    return dfs(i + 1, f + s[i + 1]) + dfs(i + 1, f + "+" + s[i + 1])


print((dfs(0, s[0])))

-sum = 0 -for bit in range(1 << (len(s) - 1)): -    f = s[0] -    for i in range(len(s) - 1): -        if bit & (1 << i): -            f += "+" -        f += s[i + 1] -    sum += eval(f) -print(sum) + + +def dfs(i, f): +    if i == len(s) - 1: +        return sum(list(map(int, f.split("+")))) +    return dfs(i + 1, f + s[i + 1]) + dfs(i + 1, f + "+" + s[i + 1]) + + +print((dfs(0, s[0])))