local x = io.read("*n")
while true do
  local lim = math.ceil(math.sqrt(x))
  local f = true
  for i = 2, lim do
    if x ~= i and x % i == 0 then
      f = false
      break
    end
  end
  if f then print(x) break else x = x + 1 end
end
