fun judge(N: Int): Boolean {
	var a = mutableListOf<Int>()
	var n = N
	while (n != 0) {
		val j = n % 10
		if (a.size == 0) {
			a.add(j)
		} else if (j != a[0]) {
			return false
		}
		n /= 10
	}
	return true
}

fun main(args: Array<String>) {
	var n = readLine()!!.toInt()
	while (!judge(n)) {
		n += 1
	}
	println(n)
}