'use strict';
function main(input) {
  const X = parseInt(input);
  var x = X;
  var D = true;
  while (D) {
    D = false;
    for (let i = 2; i < x; ++i) {
      if (x % i === 0) {
        D = true;
        ++x;
        break;
      }
    }
  }
  console.log(x);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));