fun main(args : Array<String>) {
    val x = readLine()!!.toLong()
    println(prime(x))
}

fun prime(from : Long) : Long {
    var current = from
    while (true) {
        val max = Math.sqrt(current.toDouble()).toLong()
        if ((2..max).all { i -> current % i != 0L }) {
            return current
        }
        current++
    }
}