import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS

readInt = fst . fromJust . BS.readInt
getInt = readInt <$> BS.getLine

main = do
    x <- getInt
    print $ solve x

isPeime 1 = True
isPrime 2 = True
isPrime n = and $ map (prime n) [2..(n-1)]

prime n m = (n `mod` m) /= 0

solve x = head [y | y <- [x..], isPrime y]