require 'prime' a=Prime.each(100200).to_a.select{|e|e>10**5} b=[1]+a.repeated_combination(2).map{|x,y|x*y}.sort puts b[gets.to_i-1]