a=gets.to_i puts (0..10).map{|i|(0..6).map{|m|10**m}.map{|j|j*i}}.flatten.uniq.sort.reverse.select{|i|i<=a}