#include <iostream>
using namespace std;
int estePrim(int x) {
int prim=1, d=2;
while (d<=x/2) {
if (x%d==0) prim=0;
d = d+1;
}
return prim;
}
int main(){
unsigned n,i,d,OK, prim;
cout<<"n="; cin>>n;
i = n+1;
while(!OK) {
OK = estePrim(i);
if(OK == 1) {
prim = i;
}
i++;
}
cout<<prim;
return 0;
}