fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    when {
        n <= 9 -> print(n)
        n <= 99 -> print(9)
        n <= 999 -> print(9 + (n - 99))
        n <= 9999 -> print(9 + 900)
        n <= 99999 -> print(9 + 900 + (n - 9999))
        else -> print(90909)
    }
}
