n = int(eval(input()))

ok = False

for i in range(1,10):

    if int(str(i)*3)>=n:

        print((str(i)*3))

        exit()
n = int(eval(input()))

for i in range(1, 10):

    if n <= i * 111:

        print((i * 111))

        exit()

n = int(eval(input()))
ok = False
for i in range(1, 10):
    if int(str(i) * 3) >= n:
        print((str(i) * 3))
        exit()

n = int(eval(input()))
for i in range(1, 10):
    if n <= i * 111:
        print((i * 111))
        exit()

-ok = False -    if int(str(i) * 3) >= n: -        print((str(i) * 3)) +    if n <= i * 111: +        print((i * 111))