n = gets.to_s
degit = n.length - 1
n = n.to_i

case degit
when 1
  result = n
when 2
  result = 9
when 3
  result = n - 100 + 10
when 4
  result = 909
when 5
  result = n - 10000 + 910
when 6
  result = 90909
end

puts result