#include<iostream>
using namespace std;
int main()
{
	int i,j,n,count;
	cin>>n;
	for(j=n;j<n+1000;j++)
	{
	count=0;
	for(i=2;i<j/2;i++)
	{
		if(j%i==0)
		count+=1;
		
	}
		if (count==0)
		{
		cout<<j;
		exit(0);
		}
	}
	return 0;
}