import scala.io.StdIn._

/**
 * ABC111B
 */
object Main extends App {

  val n = readInt()

  val ans = n match {
    case n if n <= 111 => 111
    case n if n <= 222 => 222
    case n if n <= 333 => 333
    case n if n <= 444 => 444
    case n if n <= 555 => 555
    case n if n <= 666 => 666
    case n if n <= 777 => 777
    case n if n <= 888 => 888
    case _             => 999
    }

  println(ans)
}