#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long n) {
  if (n == 2 or n == 3)
    return true;
  else if ((n - 1) % 6 == 0 or (n + 1) % 6 == 0)
    return true;
  else
    return false;
}
void solve() {
  long long n;
  cin >> n;
  for (long long i = 1; i < 10000; i++) {
    if (isPrime((n * i) + 1))
      continue;
    else {
      cout << i << "\n";
      break;
    }
  }
}
void newSolution() {
  long long n;
  cin >> n;
  if (n == 1)
    cout << 3 << "\n";
  else if (n == 2)
    cout << 4 << "\n";
  else {
    cout << n - 2 << "\n";
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long testcases = 1;
  while (testcases--) {
    newSolution();
  }
  return 0;
}
