console.log((args=>{
  let X = args.trim()|0;
  P: while(1) {
    for ( let i = 2; i*i <= X; i++ ) {
      if ( X % i === 0 ) {
        X++;
        continue P;
      }
    }
    return `${X}`;
  }
})(require('fs').readFileSync('/dev/stdin', 'utf8')));
