#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int N = 1e6 + 10;
int t, n, m, k, l, r, op, x, y;
int f[N];
bool flag;
bool isprime(int x) {
if (x < 2)return false;
k = sqrt(x);
for (int i = 2; i <= k; i++) {
if (x % i == 0)return false;
}
return true;
}
void solve() {
cin >> n;
while (!isprime(n))n++;
cout << n;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
solve();
return 0;
}