odds :: Integer -> Integer
odds n | n < 0 = 0
       | n < 10 = n
       | n < 100 = odds 9
       | n < 1000 = odds 9 + (n-99)
       | n < 10000 = odds 999
       | n < 100000 = odds 999 + (n-9999)
       | otherwise = odds 99999

main = do
  n <- readLn :: IO Integer
  putStrLn . show $ odds n
