require 'prime' n = gets.to_i if n == 1 puts 1 else a = Prime.each(10**5 + 1000).select { |i| i > 10**5 }.repeated_combination( 2 ).map { |v| v[0] * v[1] }.sort.uniq puts a[n - 2] end