#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,i,j,s,c=0;
	cin>>n;
	for(i=1;i<=n;i++){
		if(i==1){
			i++;
		}
		s=0;
		for(j=2;j<=sqrt(i);j++){
			if(i%j==0){
				s++;
			}
		}
	}
	if(s==0){
		cout<<i;
		c++;
		if(c==5){
			cout<<endl;
		}
	}
} 

/**************************************************************
	Problem: 1064
	User: huxuanchen
	Language: C++
	Result: Wrong Answer
****************************************************************/