# frozen_string_literal: true

n = gets.to_i

puts case n.to_s.size
     when 1 then n
     when 2 then 9
     when 3 then n - 90
     when 4 then 909
     when 5 then n - 9090
     when 6 then 90_909
     end