import Data.Bits
import Data.List
import Control.Monad


main :: IO ()
main = do
  n <- getLine
  let l = length n
  (print :: Int -> IO ()) $ (+) (if odd l then (read n) `mod` 10^(l-1) + 1 else 0) $ sum [10^(l'-1)*9 | l' <- [1,3..if odd l then l-2 else l-1]]
