main = do
    x <- read <$> getLine
    print $ head $ filter (>= x) primes
  where
    primes :: [Integer]
    primes = sieve (2 : [3, 5..])
    sieve (p:xs) = p : sieve [x | x <- xs, x `mod` p > 0]
