import qualified Data.Vector.Unboxed.Mutable as UM
import qualified Data.Vector.Unboxed as U
import Control.Monad

primesTo :: Int -> [Int]
primesTo n = [p | p <- [2..n], primes U.! p]
  where primes = U.create $ do
          isPrime <- UM.replicate (n + 1) True
          UM.unsafeWrite isPrime 0 False
          UM.unsafeWrite isPrime 1 False
          forM_ [2..n] $ \i -> do
            isP <- UM.unsafeRead isPrime i
            when isP $ forM_ [2 * i, 3 * i .. n] $ \j -> do
              UM.unsafeWrite isPrime j False
          return isPrime

mod5is1 :: [Int]
mod5is1 = [p | p <- primesTo 55555, p `mod` 5 == 1]

main :: IO ()
main = readLn >>= putStrLn . unwords . map show . flip take mod5is1
