n = gets.to_i

x = if n < 10
	  n
	elsif n < 100
	  9
	elsif n < 1000
	  9 + n - 99
    elsif n < 10000
      9 + 999 - 99
    elsif n < 100000
      9 + 999 - 99 + n - 9999
    else
      9 + 999 - 99 + 99999 - 9999
    end

puts x