n = int(eval(input()))

while True:

    if len(set(str(n))) == 1:

        print(n)

        break

    n += 1

n = int(eval(input()))

print((((n-1)//111+1)*111))
n = int(eval(input()))
while True:
    if len(set(str(n))) == 1:
        print(n)
        break
    n += 1

n = int(eval(input()))
print((((n - 1) // 111 + 1) * 111))

-while True: -    if len(set(str(n))) == 1: -        print(n) -        break -    n += 1 +print((((n - 1) // 111 + 1) * 111))