fun main(args: Array<String>) {
    val X = readInt()
    val list = mutableListOf<Int>()
    x@for (x in 2..100003) {
        for(l in list) if(x%l == 0) continue@x
        if (x >= X){
            println(x)
            return
        }
        list.add(x)
    }
}

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

fun Int.pow(n: Int) = Math.pow(this.toDouble(), n.toDouble())