#include using namespace std; signed main(){ int N; cin >> N; for( int i = max( 4, N - 100 ); i <= N + 100; ++i ){ int ok = 0; for( int j = 2; j * j <= i; ++j ) ok |= i % j == 0; if( ok ) cout << i << endl, exit( 0 ); } return 0; }