main = do
 s<-getLine
 let bi=f ((length s)-1)::[String]
 print $ sum.map sum.map (map read). map words $ formulae s bi
f 0 = [[]]
f n = (map ('0':) (f (n-1)) )++(map ('1':) (f (n-1)))
g (x:xs) (y:ys)
    |y=='0' = x:(g xs ys)
    |otherwise = x:' ':(g xs ys)
g [x] _ = [x]
g _ _ = []

formulae x ys= zipWith ($) (map (flip g) ys) (repeat x)