fun main(args: Array<String>) {
    val zorome = intArrayOf(111, 222, 333, 444, 555, 666, 777, 888, 999)
    val n = readLine()!!.toInt()
    for (x in n..999) {
        if (zorome.indexOf(x) != -1) {
            println(x)
            break
        }
    }
}
