#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcdEx(ll a, ll b, ll *x, ll *y){if(!a){*x=0;*y=1;return b;}
ll x1,y1,gcd=gcdEx(b%a,a,&x1,&y1); *x=y1-(b/a)*x1;*y=x1; return gcd;}
ll modI(ll b, ll m)      {ll x,y;gcdEx(b,m,&x,&y);return (x%m+m)%m;}

typedef pair<ll, ll>      pii;
typedef vector<ll>         vi;
typedef vector<pii>         vii;
typedef set<ll>            si;
typedef map<string, ll>    msi;
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define loop(i,b,n)           for(ll i=b;i<n;i++)
#define loopv(b,n,a)         for(ll i=b;i<n;i+=a)
#define loopr(b,n)           for(ll i=n;i>=0;i--)

#define sum(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())

#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
                      cerr << "\n\n" << "Time elapsed: " << \
                      (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
                      return 0
#define mp                  make_pair
#define ff                  first
#define ss                  second
#define pb                  push_back
#define MOD                 1000000007
#define modA(a,b)           (((a%MOD)+(b%MOD))%MOD)
#define modS(a,b)           (((((a%MOD)-(b%MOD))%MOD)<0)?(int)(MOD+((a%MOD)-(b%MOD))%MOD):(int)(((a%MOD)-(b%MOD))%MOD))
#define modM(a,b)           (ll)((((ll)(a%MOD))*((ll)(b%MOD)))%MOD)
#define modD(a,b)           ((modI(b,MOD)*(a%MOD))%MOD)

#define trace1(x)                  cerr<<#x<<": "<<x<<endl
#define trace2(x, y)               cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)            cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)         cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)      cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<end
ll modP(ll x, ll y)         {ll r=1; x%=MOD; while(y>0){if(y&1){r=(r*x)%MOD;}
y=y>>1; x=(x*x)%MOD;} return r;}
ll min(ll a,ll b ) {     if(a<b)     return a;     else    return b;  }
ll max(ll a,ll b ) {     if(a>b)     return a;     else    return b;  }
ll brute(string s)
{
    ll ans=0,n,b;
string ss,a="";
n=s.size();
loop(l,0,n)
{

loop(r,l,n)
{
    a=s;
    loop(k,l,r+1)
    {
    if(a[k]=='1')
a[k]='0';
else
    a[k]='1';
    }
    loop(i,0,n-1)
    if(a[i]==a[i+1])
    ans++;
}
}
    return ans;
}
int main()
{
    cin.sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
ll t;
//  cin>>t;
// freopen("input.txt","r",stdin);freopen("output.txt","w",stdout); 
t=1;
ll n=1e6+5;
bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (ll p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { for (ll i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
  vector<ll> v;
    for (ll p=2; p<=n; p++) 
       if (prime[p])
       v.push_back(p); 
 while(t--)
{
ll ans=0,a,b,k;
cin>>a; 
n=v.size();
for(ll i=0;i<n;i++) 
{
  if(v[i]>=a) 
  {
    ans=v[i]; 
    break; 

  }
}
cout<<ans<<"\n";
}
   return 0;

}


Measured memory_bytes: 2424