n=int(eval(input()))

if 100<=n<=111:

    print((111))

elif 112<=n<=222:

    print((222))

elif 223<=n<=333:

    print((333))

elif 334<=n<=444:

    print((444))

elif 445<=n<=555:

    print((555))

elif 556<=n<=666:

    print((666))

elif 667<=n<=777:

    print((777))

elif 778<=n<=888:

    print((888))

elif 889<=n<=999:

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

L=[111,222,333,444,555,666,777,888,999]

for i in L:

    if n<=i:

        print(i)

        break
n = int(eval(input()))
if 100 <= n <= 111:
    print((111))
elif 112 <= n <= 222:
    print((222))
elif 223 <= n <= 333:
    print((333))
elif 334 <= n <= 444:
    print((444))
elif 445 <= n <= 555:
    print((555))
elif 556 <= n <= 666:
    print((666))
elif 667 <= n <= 777:
    print((777))
elif 778 <= n <= 888:
    print((888))
elif 889 <= n <= 999:
    print((999))

n = int(eval(input()))
L = [111, 222, 333, 444, 555, 666, 777, 888, 999]
for i in L:
    if n <= i:
        print(i)
        break

-if 100 <= n <= 111: -    print((111)) -elif 112 <= n <= 222: -    print((222)) -elif 223 <= n <= 333: -    print((333)) -elif 334 <= n <= 444: -    print((444)) -elif 445 <= n <= 555: -    print((555)) -elif 556 <= n <= 666: -    print((666)) -elif 667 <= n <= 777: -    print((777)) -elif 778 <= n <= 888: -    print((888)) -elif 889 <= n <= 999: -    print((999)) +L = [111, 222, 333, 444, 555, 666, 777, 888, 999] +for i in L: +    if n <= i: +        print(i) +        break