f ::Int -> Int
f x = if (length (filter (0/=) (map (x`mod`) [2..(ceiling (fromIntegral x/fromIntegral 2))]))) == ((ceiling (fromIntegral x/fromIntegral 2))-1)  then x else f (x+1)
main = do
 n<-readLn
 print$f (n+1)