n=str(eval(input()))

if n[0] == n[1] and n[1] == n[2]:

    print(n)

else:

    for i in [111,222,333,444,555,666,777,888,999]:

        if int(n) < i:

            print(i)

            quit()

n = int(eval(input()))



for i in range(1, 10):

    ans = int(str(i)*3)

    if n <= ans:

        print(ans)

        break

n = str(eval(input()))
if n[0] == n[1] and n[1] == n[2]:
    print(n)
else:
    for i in [111, 222, 333, 444, 555, 666, 777, 888, 999]:
        if int(n) < i:
            print(i)
            quit()

n = int(eval(input()))
for i in range(1, 10):
    ans = int(str(i) * 3)
    if n <= ans:
        print(ans)
        break

-n = str(eval(input())) -if n[0] == n[1] and n[1] == n[2]: -    print(n) -else: -    for i in [111, 222, 333, 444, 555, 666, 777, 888, 999]: -        if int(n) < i: -            print(i) -            quit() +n = int(eval(input())) +for i in range(1, 10): +    ans = int(str(i) * 3) +    if n <= ans: +        print(ans) +        break