function Main(input) {
  var x = parseInt(input.trim());
  var xsqrt = Math.sqrt(x);
  
  for (var n = x; true; n++) {
    var prime = true;
    for (var a = 2; a <= xsqrt; a++) {
      if (n % a == 0) {
        prime = false;
        break;
      }
    }
    if (prime) {
      console.log(n);
      return;
    }
  }
};
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
