// yukicoder NO.192 #include using namespace std; int main() { int n; cin >> n; int ans = 1; int lim1 = n - 100; int lim2 = n + 1000; bool flag = false; for (int i = lim1; i <= lim2; ++i) { for (int j = 2; j <= i; ++j) { if (i % j == 0 && i > 3) { ans = i; flag = true; break; } else continue; } if (flag) break; else continue; } cout << ans << "\n"; return 0; }