-- yukicoder My Practice -- author: Leonardone @ NEETSDKASU main = readLn >>= print . g where f x p c | m > 0 = (x, c) | otherwise = f d p (c + 1) where (d, m) = divMod x p g x = r2 * (h d2 3 1) where (d2, c2) = f x 2 0 r2 = 1 + (mod c2 2) h z i y | z == 1 = y | z < i * i = y * z | otherwise = h d (i + 2) (y * r) where (d, c) = f z i 0 r = if 1 == mod c 2 then i else 1