M=22**5 a=[0]*-~M (1..M).map{|i|(1..M/i).each{|j|a[i*j]+=1}} p (1..M).select{|i|a[i]==4}[gets.not_nil!.to_i-1]