import itertools

import math

import fractions

import functools

n = int(eval(input()))



i = math.ceil(n / 111)

print((i*100+i*10+i))
n = int(eval(input()))



if n % 111 == 0:

    print(n)

    quit()



print(((n//111+1)*111))
import itertools
import math
import fractions
import functools

n = int(eval(input()))
i = math.ceil(n / 111)
print((i * 100 + i * 10 + i))

n = int(eval(input()))
if n % 111 == 0:
    print(n)
    quit()
print(((n // 111 + 1) * 111))

-import itertools -import math -import fractions -import functools - -i = math.ceil(n / 111) -print((i * 100 + i * 10 + i)) +if n % 111 == 0: +    print(n) +    quit() +print(((n // 111 + 1) * 111))