'use strict'
const Main = (input) =>{
  let xs = input.trim().split(' ').map(v=>parseInt(v,10));
  let sqrt = Math.ceil(Math.sqrt(xs[0]));
  let num = xs[0];

  for(let n=num; true; n++){
    let prime = true;
      for(let i = 2; i<sqrt; i++){
        if(n%i==0){
          prime = false;
          break;
        }
      }
      if(prime){
        console.log(n);
        return;
      }
  }
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));