import Data.Char (digitToInt)

generate :: Int -> [[Int]]
generate 0 = [[1]]
generate n = concatMap (\xs -> map (\x -> x:xs) [0,1]) $ generate (n-1)

func :: [Int] -> String -> Int -> Int -> Int
func [] _ _ total = total
func (n:ns) (x:xs) acc total = case n of
  0 -> func ns xs acc' total
  1 -> func ns xs 0 (acc' + total)
  where
    acc' = (+) (acc * 10) $ digitToInt x

main = do
  line <- getLine
  let
    n = length line
    ans = sum $ map (\x -> func x line 0 0) $ generate (n-1)
  putStrLn $ show ans
