"use strict";

function main(input) {
  input = input.trim();
  let X = Number(input);
  while (true) {
    let flag = false;
    for (let i = 2; i < X; i++) {
      if (X % i == 0) {
        X++;
        flag = true;
        break;
      }
    }
    if (!flag) {
      console.log(X);
      break;
    }
  }
}

main(require("fs").readFileSync("/dev/stdin", "utf-8"));
