import Data.Bits
import Data.List
import Control.Monad
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as VM
import Data.Array
import Data.Array.MArray
import Data.Array.ST
import Control.Monad.ST
import Data.Maybe (fromMaybe)
import qualified Data.ByteString.Lazy.Char8 as B
import Debug.Trace


main :: IO ()
main = do
  n <- getLine
  let l = length n
  (print :: Int -> IO ()) $ if l == 1 then read n else (+) (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]]
