import Data.List isprime :: Integer -> Bool isprime 1 = False isprime 2 = True isprime n = if n `mod` 2 == 0 then False else and [ n `mod` i /= 0 | i <- [3,5..sq] ] where sq = (floor . sqrt . fromIntegral) n primefact' :: Integer -> Integer -> [Integer] primefact' 1 _ = [1] primefact' n p = if n `mod` p == 0 then if isprime (n `div` p) then p : [n `div` p] else p : primefact' (n `div` p) p else primefact' n (p + 1) primefact :: Integer -> [Integer] primefact n = if isprime n then [n] else primefact' n 2 main = do n <- readLn print $ (product . concat . map (\x -> if mod (length x) 2 == 0 then [] else [head x]) . group . primefact) n