-- yukicoder My Practice -- author: Leonardone @ NEETSDKASU main = readLn >>= print . g 3 . f 2 where f k x | mod x k > 0 = x | otherwise = f k (div x k) g i x | x < k = x | otherwise = g (i + 2) (f k x) where k = i * i