A = gets.to_i loga = Math.log(A) min = 10 ** 18 (2 .. A).each{|n| m = (loga / Math.log(n)).ceil if n*m < min warn [n, m, n*m].inspect min = n*m end break if n > min } puts min