#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int f = 0;
  int m = 1;
  int d = 0;
  int k = 0;
  while (f == 0) {
    k = m * n + 1;
    for (int i = 2; i < k; i++)
      if (k % i == 0) d++;
    if (d > 0)
      f = 1;
    else
      m++;
  }
  cout << m << endl;
  return 0;
}
