N = gets.to_i - 1 x = [] (1 .. 9).each do |a| (a + 1 .. 9).each do |b| x << [a, b] end end a, b = x[N % 36] puts "#{a}#{b}" + "#{b}" * (N / 36)