fun main(args: Array<String>) {
    val A = readLine()!!.toLong()
    var Sosu :Long = A

    loop@while (true){
        var Count : Long = 2
        while (true){
            if (Sosu % Count == 0L && Sosu != Count){
                break
            }else if (Sosu == Count){
                break@loop
            }
            Count++
        }
        Sosu++
    }


    println(Sosu)
}