fun isPrime(x: Int): Boolean {
    var i = 2
    while (i * i <= x) {
        if (x % i == 0) return false
        i++
    }
    return true
}

fun main(args: Array<String>) {
    var x = readLine()!!.toInt()
    while (true) {
        if (isPrime(x)) {
            println(x)
            return
        }
        x++
    }
}