import Data.Int (Int64) import qualified Data.Map.Strict as M type Count = Int type Counter a = M.Map a Count addElement :: Ord a => a -> Counter a -> Counter a addElement x = M.insertWith (+) x 1 countElements :: Ord a => [a] -> Counter a countElements = foldr addElement M.empty primes :: Integral a => [a] primes = [2, 3, 5] ++ sieve 5 7 (drop 2 primes) where sieve m s (p : ps) = [n | n <- ns, gcd m n == 1] ++ sieve (m * p) (p * p) ps where ns = [x + y | x <- [s, s + 6 .. p * p - 2], y <- [0, 4]] sieve _ _ [] = [] factorize :: Integral a => a -> [a] factorize 1 = [] factorize x = factorize' x primes where factorize' n ps@(p : pr) | p * p > n = [n] | m == 0 = p : factorize' d ps | otherwise = factorize' n pr where (d, m) = divMod n p factorize' _ [] = [] solve :: Integral a => a -> a solve x = product . fmap fst . M.toList $ M.filter odd ctr where ctr = countElements $ factorize x main :: IO () main = print . solve =<< (readLn :: IO Int64)