#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;


#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


const double PI = acos(-1.0);

typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int uint64;


/*******  All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)

#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, initial, maximum, increment) for(int i=initial ; i<maximum ; i+=increment)
#define RFOR(i, initial, minimum, increment) for(int i=initial ; i>=minimum ; i-=increment)
#define REP(i, maximum) FOR(i, 0, maximum, 1)
#define RREP(i, min) RFOR(i, min, 0, 1)
#define ALL(cont) cont.begin(), cont.end()
#define RALL(cont) cont.end(), cont.begin()

#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define ASSERT(A, B, C) assert( B <= A && A <= C)

typedef pair<int, int> PAIRI;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PAIRI> VII;
typedef vector<VI> VVI;
typedef map<int, int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;

//io
#define MP make_pair
#define PB(a) push_back((a))
#define F first
#define S second

#define CIN(n_) cin>>(n_)
#define CINVEC(vector1,n_) REP(i,n_){int j_;cin>>(j_);vector1.PB(j_);}
#define CIN2DVEC(V_,n_,m_) vector<int>vec_;REP(i,n_){REP(j,m_){int l_;cin>>l_;vec_.push_back(l_);}V_.push_back(vec_);vec_.clear();}

#define COUTVARENDL(x) cout<<(x)<<endl
#define COUTVARSPACE(x) cout<<(x)<<" "
#define COUTENDL() cout<<endl

#define COUTVEC(x) for(auto &el_: (x) )cout<<el_<<" ";cout<<endl

#define MINVEC(vec) *std::min_element(vec.begin(), vec.end())
#define MAXVEC(vec)  *std::max_element(vec.begin(), vec.end())


//number of 1's
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)

//memset
#define M0(x) memset(x,0,sizeof(x))
#define M1(x) memset(x,63,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define CLR(ar, val) memset(ar, val, sizeof(ar))
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))

//const
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define READ(type) readInt<type>()
#define SIZE(x) ((int)(x).size())


#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

//math
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

//int QP(int a,int64 b){int ans=1;do{if(b&1)ans=1int64*ans*a%MOD;a=1int64*a*a%MOD;}while(b>>=1);return ans;}
//int QP(int a,int64 b,int MOD){int ans=1;do{if(b&1)ans=1int64*ans*a%MOD;a=1int64*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }

int DX[4] = {1, 0, -1, 0};
int DY[4] = {0, 1, 0, -1};


//uncomment to use
//素数篩、階乗とあるmodでのその逆元、カタラン数、二項係数
void precalc() {

    /*for (int i = 2; i < C; ++i) {
       if (!least_prime[i]) {
           least_prime[i] = i;
           for (li j = i * 1LL * i; j < C; j += i) {
               least_prime[j] = i;
           }
       }
   }*/

    /*fact[0] = revfact[0] = 1;
   for (int i = 1; i < 100500; ++i) {
   fact[i] = fact[i - 1] * i % curMod;
   revfact[i] = binpow(fact[i], curMod - 2, curMod);
   }*/

    /*for (int w = 0; w < 2; ++w) {
   powers[w][0] = 1;
   for (int j = 1; j < C; ++j) {
   powers[w][j] = (powers[w][j - 1] * 1LL * pr[w]) % mods[w];
   }
   }*/

    /*catalan[0] = 1;
   for (int n = 0; n < 200500 - 1; ++n) {
   catalan[n + 1] = catalan[n] * 2 * (2 * n + 1) % MOD * binpow(n + 2, MOD - 2, MOD) % MOD;
   }*/

    /*for (int i = 0; i < 5010; ++i) {
   c[i][i] = c[i][0] = 1;
   for (int j = 1; j < i; ++j) {
   c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % MOD;
   }
   }*/

    /*for (int i = 0; i < 100; ++i) {
   doubleC[i][i] = doubleC[i][0] = 1.0;
   for (int j = 1; j < i; ++j) {
   doubleC[i][j] = doubleC[i - 1][j - 1] + doubleC[i - 1][j];
   }
   }*/
}

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif


 
int isPrime(int n) {
    double squareRoot = sqrt(n);

    if (n == 1 || n == 2 || n == 3) {
        return 1;
    }

    for (int i = 2; i <= (int) squareRoot; i++) {
        if ((n % i) == 0) {
            return 0;
        }
    }
    return 1;
}
int solve() {
  
  int a,b;
  cin>>a;
  b = a;
  while(true){
     if(isPrime(b) == true){
       cout<<b;
       return 0;
     }else{
       b++;
     }
  }
  return 0;


}


int main(int argc, char **argv) {
    cin.tie(0);
    ios_base::sync_with_stdio(false);

    solve();
    return EXIT_SUCCESS;
}


Measured memory_bytes: 256