fun solve(line: String): String {
    var x = line.toLong()
    for (i in x..2*x) {
        if (isPrime(i)) return "$i"
    }
    return "$x"
}

fun isPrime(n: Long): Boolean {
    for (i in 2..n/2) {
        if (n % i == 0L) return false
    }
    return true
}

fun main(args: Array<String>) {
    println(solve(readLine()!!))
}