let nAndLog n = n, n |> double |> log10 |> floor |> int

stdin.ReadLine() |> int
|> nAndLog
|> fun (n, l) ->
    [for k in 0..l do
        yield match k with
              | 0 -> 9
              | 2 -> 900
              | 4 -> 90000
              | _ -> 0]
    |> Seq.sum
    |> (+) (
        match l with
        | 0 -> n - 9
        | 2 -> n - 900 - 99
        | 4 -> n - 90000 - 9999
        | _ -> 0
        )
|> printfn "%d"
