#include <bits/stdc++.h>   using namespace std;   #pragma comment(linker,  /stack:200000000 )   #pragma GCC optimize( Ofast )   #pragma GCC target(         sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native )   #pragma GCC optimize( -ffloat-store )   const long long INF = 0xFFFFFFFFFFFFFFFL;   const long long N = 1e9 + 7;   vector<long long> pri;   void yo(int n) {     bool prime[n + 1];     memset(prime, true, sizeof(prime));     for (int p = 2; p * p <= n; p++) {       if (prime[p] == true) {         for (int i = p * p; i <= n; i += p) prime[i] = false;       }     }     for (int p = 2; p <= n; p++)       if (prime[p]) pri.push_back(p);   }   void solve() {     long long n;     cin >> n;     for (long long i = 1; i < 1001; i++) {       if (!binary_search((pri).begin(), (pri).end(), n * i + 1)) {         cout << i;         return;       }     }   }   int32_t main(int32_t argc, char **argv) {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     yo(1000003);     long long t;     t = 1;     while (t--) solve();     cerr <<   n           <<  Time :   << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC          <<  ms n ;     return 0;   }   