main = getLine >>= print . solve . read . head . words solve :: Int -> Int solve n = div n $ foldl (\acc x -> if acc == n && mod n x == 0 then x else acc) n primes where primes = primes' [2..n] (sqrt $ fromIntegral n) primes' [] _ = [] primes' (x : xs) mb | fromIntegral x < mb = x : primes' [y | y <- xs, mod y x /= 0] mb | otherwise = x : xs