function judge(n)
	for i = 2, math.sqrt(n) do
    	if n % i == 0 then
      		return false
      	end
    end
  return true
end

n = tonumber(io.read())

for i = n, n + 10000 do
  	if judge(i) then
    	print(i)
    	break
    end
end