X=io.read"*n"

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

while(true)do
	if(f(X))then print(X)return end
	X=X+1
end