#define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include #include //#include "util.h" using namespace std; typedef long long lint; typedef pair Pii; #define PI 3.14159265358979323846 #define EPS 1e-6 #define MOD ((lint)1000000007) #define MIN(a,b) ((a)<(b)?(a):(b)) #define MAX(a,b) ((a)>(b)?(a):(b)) int main() { vector c(2048, false); for (int i = 2; i * i <= 1100; i++) if (!c[i]) for (int j = i * i; j <= 1100; j += i) c[j] = true; int N; cin >> N; for (int i = N - 100; i <= N + 100; i++) { if (c[i]) { cout << i << endl; return 0; } } return 0; }