object Main {
  def main(args: Array[String]) {
      val factor = scala.io.StdIn.readLine
      var num_hund = factor(0).toString.toInt

      if( factor(0).toInt < factor(1).toInt ||
         (factor(0).toInt == factor(1).toInt && factor(1).toInt < factor(2).toInt)
        ) {
        num_hund += 1
      }
      else {}

      println(num_hund*111)
  }
}
