import Data.Char

main = interact $ show . sol . get

get = fmap (read . (:[])) . filter isDigit

sol = f =<< length

f 1 [x] = x
f n (x:xs) = x*(4*10^(n-1) + 5*10^(n-2) - 2^(n-2)) `div` 4 + 2*f (n-1) xs
