require 'prime' (1..10000_00000).filter{|x| !Prime.prime?(x) && (1..Math.sqrt(x).floor).select{|n| x % n == 0}.map{|n| [n, x/n]}.reduce([]) {|a, b| a << b[0] << b[1]}.any?{|d| d >= 10 ** 5} }[gets.to_i-1]