object Main extends App{
  import scala.io.StdIn.readInt
  
  val m = readInt
  
   def isPrime(n: Int): Boolean = {
     n > 1 && (2 until n).forall(n % _ != 0)
   }
  val primes = Stream.range(m , 3*m+1).filter(isPrime(_))
  println(primes.head.toString)
}
