
import System.Environment
import Data.Maybe

suCC :: Int -> Int
suCC x = x + 1

isdivs :: Int  -> Int -> Bool
isdivs n x = mod x n /= 0

the_filter :: [Int] -> [Int]
the_filter (n:ns) = filter (isdivs n) ns

primes :: [Int]
primes = map head (iterate the_filter (iterate suCC 2))

main = do
	as <- getArgs
        let arg = fromMaybe "3000" (listToMaybe as)
	print $ primes !! (read arg)

