function Main(input) {
    input = input.trim();
    input = input.split(" ");
    var a = parseInt(input[0]);        

    var bool = true;
    while(bool){
        var flag = false;
        for(var i=2;i<a;i++){
            if(a%i==0){
                flag = true;
                break;
            }
        }
        
        if(!flag){
            bool = false;
        }else{
                a+=1;
            }
    }
    
    console.log(a);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8")); 
