n = eval(input())

if n[0] == n[1] and n[1] == n[2] and n[2] == n[0]:

    print(n)

else:

    n1 = int(n)

    n_tmp = int(n[0])

    n2 = n_tmp*100 + n_tmp*10 + n_tmp

    n3 = (n_tmp+1)*100 + (n_tmp+1)*10 + n_tmp+1

    if n2 >= n1:

        print(n2)

    else:

        print(n3)

n = int(eval(input()))

for i in range(111, 1000, 111):

    if i >= n:

        print(i)

        exit()

    else:

        continue

n = eval(input())
if n[0] == n[1] and n[1] == n[2] and n[2] == n[0]:
    print(n)
else:
    n1 = int(n)
    n_tmp = int(n[0])
    n2 = n_tmp * 100 + n_tmp * 10 + n_tmp
    n3 = (n_tmp + 1) * 100 + (n_tmp + 1) * 10 + n_tmp + 1
    if n2 >= n1:
        print(n2)
    else:
        print(n3)

n = int(eval(input()))
for i in range(111, 1000, 111):
    if i >= n:
        print(i)
        exit()
    else:
        continue

-n = eval(input()) -if n[0] == n[1] and n[1] == n[2] and n[2] == n[0]: -    print(n) -else: -    n1 = int(n) -    n_tmp = int(n[0]) -    n2 = n_tmp * 100 + n_tmp * 10 + n_tmp -    n3 = (n_tmp + 1) * 100 + (n_tmp + 1) * 10 + n_tmp + 1 -    if n2 >= n1: -        print(n2) +n = int(eval(input())) +for i in range(111, 1000, 111): +    if i >= n: +        print(i) +        exit() -        print(n3) +        continue