fun main() {
    val x= readLine()!!.toInt()
    fun judge(n:Int):Boolean{
        var ans=true
        for (i in 2 until Math.sqrt(n.toDouble()).toInt()){
            if (n%i==0){ans=false; break}
        }
        return ans
    }
    var now=x
    while (!judge(now)){now++}
    println(now)
}