k = gets.to_i

a = []

(1..9).each{|x| a << x.to_s}
(1..9).each{|x| a << x.to_s + "9"}
(1..9).each{|x| a << x.to_s + "99"}
(2..10).each{|len|
    base = "9" * len
    list = [(1..9).map{|i| i.to_s + "9"} + (10...len*10).map{|x| x.to_s}].flatten.sort.uniq
    list.each{|x| a << x.to_s + base}
}
len = 11
loop {
    break if a.size >= k
    base = "9" * len
    (10..99).each{|x| a << x.to_s + base}
    len += 1
}

puts a[0...k]