fun main(args: Array<String>) {
  val N = readLine()!!.toInt()
  var ans = N
  var count = 1
  while(true) {
    ans -= 111
    if(ans <= 0){
      println(111*count)
      return
    }
    count++
  }
}