fun main(args: Array<String>){
    val isSosu = mutableListOf<Boolean>()
    for (tmp in 1..200005){
        isSosu.add(true)
    }
    isSosu[0] = false
    isSosu[1] = false
    for (i in 2..200000){
        if (!isSosu[i]) continue
        for (j in (2*i)..200000 step i){
            isSosu[j] = false
        }
    }

    val x = readLine()!!.toInt()
    for(i in x..200000){
        if(isSosu[i]){
            println(i)
            return
        }
    }
}
