main::IO() main = do ni <- fmap read getLine print . head $ [x | x<-[(ni-100)..(ni+100)], isGouseisuu x] where isGouseisuu x = (filter (\y->(x `mod` y) ==0) [2..(x-1)]) /= []