#include #define rep(i, ss, ee) for (int i = ss; i < ee; ++i) using namespace std; int N; bool func(int n) { int cnt = 0; for (int i = 1; i * i <= n; i++) { if (n % i == 0) { cnt++; if (i * i != n) cnt++; } if (cnt > 2) return true; } if (cnt > 2) return true; return false; } void input() { cin >> N; } void solve() { int ans; rep(i, N - 100, N + 101) { if (func(i)) { cout << i << endl; break; } } } int main() { ios::sync_with_stdio(false); cin.tie(0); input(); solve(); getchar(); }