fun main(arr:Array<String>) {
    val x = readLine()!!.toInt()
    val ans = getPrimeList().filter { it >= x }.min()!!
    println(ans)
}

fun getPrimeList():List<Int> {
    val arr = BooleanArray(200000)
    val list = mutableListOf<Int>()
    for(i in (2 until arr.size)) {
        if(arr[i]) {
            continue
        }
        list.add(i)
        for(j in (1 until  arr.size)) {
            if(i * j >= arr.size) {
                break
            }
            arr[i*j] = true
        }
    }
    return list
}