#include <bits/stdc++.h>
int main() {
  int num;
  scanf("%d", &num);
  if (num > 2)
    printf("%d\n", num - 2);
  else if (num == 2)
    printf("4\n");
  else if (num == 1)
    printf("3\n");
  return 0;
}
