Kurohashi has never participated in AtCoder Beginner Contest (ABC).
The next ABC to be held is ABC N (the N-th ABC ever held).
Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same.
What is the earliest ABC where Kurohashi can make his debut?

-----Constraints-----
 - 100 \leq N \leq 999
 - N is an integer.

-----Input-----
Input is given from Standard Input in the following format:
N

-----Output-----
If the earliest ABC where Kurohashi can make his debut is ABC n, print n.

-----Sample Input-----
111

-----Sample Output-----
111

The next ABC to be held is ABC 111, where Kurohashi can make his debut.

Difficulty: EASY

Solutions:
n = input()
a = int(n[0] * 3)
if int(n) <= a:
	print(a)
else:
	print(str(int(n[0]) + 1) * 3)


n = int(input())
a = (n - 1) / 111
b = (a + 1) // 1
print(int(100 * b + 10 * b + b))


a = int(input())
print(111 * ((a - 1) // 111 + 1))


num = int(input())
print(111 * ((num + 110) // 111))


for i in range(int(input()), 1000):
	if i % 111 == 0:
		print(i)
		exit()


print(-int(input()) // 111 * -111)


N = int(input())
if N % 111 == 0:
	print(N)
else:
	for i in range(110):
		N += 1
		if N % 111 == 0:
			break
	print(N)


n = int(input())
ans = n // 111 * 111
print(ans if ans == n else ans + 111)


print((9 - (999 - int(input())) // 111) * 111)


print((110 + int(input())) // 111 * 111)


N = int(input())
print(str((N - 1) // 111 + 1) * 3)


n = int(input())
div_n = -(-n // 111)
print(111 * div_n)


print(((int(input()) - 1) // 111 + 1) * 111)


n = int(input())
ret = (n - 1) // 111 + 1
print(ret * 111)


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


import math
n = int(input())
print(math.ceil(n / 111) * 111)


N = int(input())
print(-N % 111 + N)


n = int(input())
for i in range(n, 1000):
	if i % 111 == 0:
		print(i)
		return


N = int(input())
x = 111 * ((N - 1) // 111 + 1)
print(x)


a = int(input())
b = a % 100
c = a // 100
if b <= c * 11:
	print(c * 111)
else:
	print((c + 1) * 111)


n = int(input())
print((0 - -n // 111) * 111)


n = int(input())
li = [int(str(i) * 3) for i in range(10)]
import bisect
x = bisect.bisect_left(li, n)
print(li[x])


from math import ceil
print(ceil(int(input()) / 111) * 111)


a = int(input())
print(a if a % 111 == 0 else 111 * (1 + a // 111))


x = int(input())
for i in range(x, 1000):
	if i // 100 == i % 10 and i // 100 == i // 10 % 10:
		break
print(i)


N = int(input())
if N % 111:
	print(111 * (N // 111 + 1))
else:
	print(111 * int(N / 111))


(q, m) = divmod(int(input()), 111)
print((q + 1 * (m > 0)) * 111)


import math
N = int(input())
print(math.ceil(N / 111.0) * 111)


n = int(input())
a = -(-n // 111)
if a == 10:
	print(1111)
else:
	print(a * 111)


n = int(input())
print((n // 111 + 1) * 111 if n % 111 else n)


N = int(input())
result = (N + 110) // 111 * 111
print(result)


N = int(input())
S = ((N - 1) // 111 + 1) * 111
print(S)


N = int(input())
ans = 0
while ans < N:
	ans += 111
print(ans)


n = int(input())
h = n // 100
x = h * 100 + h * 10 + h
print(x) if n <= x else print(x + 111)


N = int(input())
res = 0
while N > res:
	res += 111
print(res)


n = int(input())
while n % 111 != 0:
	n = n + 1
print(n)


n = int(input())
a = n // 100 * 111
print(a if a >= n else a + 111)


n = int(input())
print(-n // 111 * -111)


n = int(input())
a = -(-n // 111)
print(a * 111)


n = int(input())
for i in range(n, 1000):
	a = i // 100
	b = (i - a * 100) // 10
	c = i - a * 100 - b * 10
	if a == b == c:
		print(i)
		return


n = int(input())
if n % 111 == 0:
	print(n)
else:
	print(n + 111 - n % 111)


import math
i = int(input())
print(111 * int(math.ceil(i / 111)))


n = int(input())
i = n // 111
if n % 111:
	i += 1
print(i * 111)


a = int(input())
print(a + (a % 111 != 0) * 111 - a % 111)


n = int(input())
print((n // 100 + (1 if n // 100 * 111 < n else 0)) * 111)


n = int(input())
if n % 111 == 0:
	print(n)
	return
while n % 111 != 0:
	n += 1
	if n % 111 == 0:
		print(n)
		return


n = int(input())
print(int((n + 110) / 111) * 111)


a = int(input())
a += 110
a //= 111
a *= 111
print(a)


N = list(input())
n = int(''.join(N))
ck = int(N[0] * 3)
if n - ck <= 0:
	print(int(N[0] * 3))
else:
	print(int(str(int(N[0]) + 1) * 3))
pass


n = int(input())
hyaku = (n - n % 100) / 100
if n % 100 > hyaku * 10 + hyaku:
	hyaku += 1
	print(int(hyaku * 100 + hyaku * 10 + hyaku))
else:
	print(int(hyaku * 100 + hyaku * 10 + hyaku))


n = int(input())
s = (n - 1) // 111
print(111 * (s + 1))


N = int(input())
X = ((N - 1) // 111 + 1) * 111
print(X)


n = int(input())
p = 1 + (n - 1) // 111
print(p * 111)


a = int(input())
u = 111
print((a // u + (a % u > 0) or 0) * u)


N = int(input())
while N % 111 != 0:
	N += 1
print(N)


N = int(input())
ans = -(-N // 111) * 111
print(ans)


n = int(input())
(q, mod) = divmod(n, 111)
if mod == 0:
	print(q * 111)
else:
	print((q + 1) * 111)


import math
a = int(input())
b = math.ceil(a / 111)
print(b * 111)


m = int(input())
print(((m - 1) // 111 + 1) * 111)


n = int(input())
i = 0
m = 0
while m < n:
	i = i + 1
	m = 111 * i
print(m)


n = int(input())
num = (n - 1) // 111
print(111 * (num + 1))


N = int(input())
res = (N + 111 - 1) // 111
print(res * 111)


n = int(input())
print(str((n - 1) // 111 + 1) * 3)


n = int(input())
ct = 0
while ct < n:
	ct += 111
print(ct)


n = int(input())
x = (n - 1) // 111 + 1
print(x * 100 + x * 10 + x)


n = int(input()) - 1
print(int(n - (n % 111 + 1) + 112))


print(0 - -int(input()) // 111 * 111)


N = int(input())
(q, mod) = divmod(N, 111)
print((q + int(mod > 0)) * 111)


N = int(input()) - 1
x = N // 111 + 1
print(x * 100 + x * 10 + x)


n = int(input())
a = 0
while a < n:
	a += 111
print(a)


n = int(input())
i = 0
while i < n:
	i += 111
print(i)


print(111 * (10 - (1110 - int(input())) // 111))


a = int(input())
for i in range(10):
	if i * 111 >= a:
		print(i * 111)
		break
	else:
		continue


n = int(input())
z = -(-n // 111) * 111
print(z)


N = int(input())
ans = N // 111
if N % 111 > 0:
	ans += 1
print(ans * 111)


N = int(input())
for i in range(N, 1000):
	if i % 111 == 0:
		print(i)
		break


print(min(range(999, int(input()) - 1, -111)))


N = int(input())
k = (N - 1) // 111 + 1
print(k * 111)


n = int(input())
x = (n - 1) // 111 + 1
print(x * 111)


def answer(n: int) -> int:
	q = n // 111
	if n % 111 != 0:
		q += 1
	return 111 * q

def main():
	n = int(input())
	print(answer(n))

def __starting_point():
	main()
__starting_point()


N = int(input())
n = N // 100
n = n * 100 + n * 10 + n
print(n + 111 if N > n else n)


N = int(input())
print(N + 111 - N % 111 if N % 111 != 0 else N)


N = int(input())
print(111 * (0 - -N // 111))


N = int(input())
a = N // 111
b = N % 111
if b > 0:
	a += 1
print(111 * a)


X = int(input())
print((X + 110) // 111 * 111)