# ABC111B

from math import ceil



print((ceil(int(eval(input())) / 111) * 111))
# ABC111B

from math import ceil



num = int(eval(input()))

print((ceil(num / 111) * 111))
# ABC111B
from math import ceil

print((ceil(int(eval(input())) / 111) * 111))

# ABC111B
from math import ceil

num = int(eval(input()))
print((ceil(num / 111) * 111))

-print((ceil(int(eval(input())) / 111) * 111)) +num = int(eval(input())) +print((ceil(num / 111) * 111))