local ior = io.read
local str = ior()
local ppos = #str - 1
local tot = (1<<ppos) - 1
local sum = 0
for i = 0, tot do
  local tsum = 0
  local t = 0
  local it = i
  for j = 1, ppos do
    if(it % 2 == 1) then
      t = t * 10 + tonumber(str:sub(j, j))
      tsum = tsum + t
      t = 0
    else
      t = t * 10 + tonumber(str:sub(j, j))
    end
    it = it // 2
  end
  tsum = tsum + t * 10 + tonumber(str:sub(#str, #str))
  sum = sum + tsum
end
print(sum)
