isPrime :: Int -> Bool
isPrime num = null(filter (\x -> num `mod` x == 0) [2..floor(sqrt(fromIntegral num))])

main = do
    [x] <- map read . words <$> getLine
    let ans = head [a | a <- [2..2*x], a>x, isPrime a ]
    putStrLn $ show ans