import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    var n = sc.nextInt()

    while (!judge(n)) {
        n++
    }
    println(n)
}

fun judge(n: Int): Boolean {
    val s = n.toString()
    return s.filter { it == s[0] }.length == s.length
}
