fun main(args: Array<String>) {
    var ans = nextLong()
    while (!isPrime(ans)) ans += 1
    println(ans)
}
fun next() = readLine()!!
fun nextLong() = next().toLong()
fun isPrime(n: Long): Boolean {
    if (n == 1L) return false
    for (k in 2 .. Math.sqrt(n.toDouble()).toLong()) {
        if (n % k == 0L) return false
    }
    return true
}