object Main extends App {
  import scala.io.StdIn._
  def is_prime(p: Long):Boolean={
    if(p<=1) return false
    for {i <- 2L to(p) if(i * i <= p)} {
      if (p % i == 0) return false
    }
    return true
  }
  val x = readLong()
  var p = x
  while (!is_prime(p)) p+=1
  println(p)
}
