for i in range(int(eval(input())), 1000):

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

    print(i)

    break
n = int(eval(input()))

 

for i in range(n,1000):

 if i % 111 == 0:

  print(i)

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

n = int(eval(input()))
for i in range(n, 1000):
    if i % 111 == 0:
        print(i)
        break

-for i in range(int(eval(input())), 1000): -    if str(i)[0] == str(i)[1] and str(i)[1] == str(i)[2]: +n = int(eval(input())) +for i in range(n, 1000): +    if i % 111 == 0: