import Data.List
import Data.Char
import Data.Maybe
import qualified Data.ByteString.Char8 as BS8

dig_impl 0 r = r
dig_impl n r = dig_impl (div n 10) (r + 1)

dig n = dig_impl n 0

cnt n r
    | dig n == 1 = n
    | dig n == 2 = 9
    | dig n == 3 = n - 90
    | dig n == 4 = 909
    | dig n == 5 = n - 9090
    | dig n == 6 = 90909

main :: IO ()
main = do
    n <- fst . fromJust . BS8.readInteger <$> BS8.getLine

    print $ cnt n n
