A = int(eval(input()))

if A <=111:

  print((111))

elif A<= 222:

  print((222))

elif A <= 333:

  print((333))

elif A <= 444:

  print((444))

elif A <= 555:

  print((555))

elif A <=666:

  print((666))

elif A <= 777:

  print((777))

elif A <= 888:

  print((888))

elif A <=999:

  print((999))
A = int(eval(input()))

B = int(A / 111)

C = A % 111 == 0

if not C:

  B = (B+1) * 111

  print(B)

else:

  B = B*111

  print(B)
A = int(eval(input()))
if A <= 111:
    print((111))
elif A <= 222:
    print((222))
elif A <= 333:
    print((333))
elif A <= 444:
    print((444))
elif A <= 555:
    print((555))
elif A <= 666:
    print((666))
elif A <= 777:
    print((777))
elif A <= 888:
    print((888))
elif A <= 999:
    print((999))

A = int(eval(input()))
B = int(A / 111)
C = A % 111 == 0
if not C:
    B = (B + 1) * 111
    print(B)
else:
    B = B * 111
    print(B)

-if A <= 111: -    print((111)) -elif A <= 222: -    print((222)) -elif A <= 333: -    print((333)) -elif A <= 444: -    print((444)) -elif A <= 555: -    print((555)) -elif A <= 666: -    print((666)) -elif A <= 777: -    print((777)) -elif A <= 888: -    print((888)) -elif A <= 999: -    print((999)) +B = int(A / 111) +C = A % 111 == 0 +if not C: +    B = (B + 1) * 111 +    print(B) +else: +    B = B * 111 +    print(B)