N= int(eval(input()))

A = [111, 222, 333, 444, 555, 666, 777, 888, 999]



for i in A:

    if N==i:

        print(i)

        break

    elif N > i:

        continue

    elif N <= i:

        print(i)

        break

    

        
n=int(eval(input()))

for i in range(n,1000):

    if str(i)[0] == str(i)[1] == str(i)[2]:

        print(i)

        exit()
N = int(eval(input()))
A = [111, 222, 333, 444, 555, 666, 777, 888, 999]
for i in A:
    if N == i:
        print(i)
        break
    elif N > i:
        continue
    elif N <= i:
        print(i)
        break

n = int(eval(input()))
for i in range(n, 1000):
    if str(i)[0] == str(i)[1] == str(i)[2]:
        print(i)
        exit()

-N = int(eval(input())) -A = [111, 222, 333, 444, 555, 666, 777, 888, 999] -for i in A: -    if N == i: +n = int(eval(input())) +for i in range(n, 1000): +    if str(i)[0] == str(i)[1] == str(i)[2]: -        break -    elif N > i: -        continue -    elif N <= i: -        print(i) -        break +        exit()