fun main(args:Array<String>){
    var x = readLine()!!.toInt()
    while(true){
        var ok = true
        for(i in 2 .. Math.sqrt(x.toDouble()).toInt()){
            if(x % i == 0) ok = false
        }
        if(ok) break
        x++
    }
    println(x)
}
