output_description: If the earliest ABC where Kurohashi can make his debut is ABC n, print n.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
attempt: import sys, re
  from math import ceil, floor, sqrt, pi, factorial  # , gcd
  from copy import deepcopy
  from collections import Counter, deque
  from heapq import heapify, heappop, heappush
  from itertools import accumulate, product, combinations, combinations_with_replacement
  from bisect import bisect, bisect_left
  from functools import reduce
  from decimal import Decimal, getcontext
  
  
  # input = sys.stdin.readline
  def i_input():
      return int(input())
  
  
  def i_map():
      return map(int, input().split())
  
  
  def i_list():
      return list(i_map())
  
  
  def i_row(N):
      return [i_input() for _ in range(N)]
  
  
  def i_row_list(N):
      return [i_list() for _ in range(N)]
  
  
  def s_input():
      return input()
  
  
  def s_map():
      return input().split()
  
  
  def s_list():
      return list(s_map())
  
  
  def s_row(N):
      return [s_input for _ in range(N)]
  
  
  def s_row_list(N):
      return [s_list() for _ in range(N)]
  
  
  def Yes():
      print("Yes")
  
  
  def No():
      print("No")
  
  
  def YES():
      print("YES")
  
  
  def NO():
      print("NO")
  
  
  def lcm(a, b):
      return a * b // gcd(a, b)
  
  
  sys.setrecursionlimit(10**6)
  INF = float("inf")
  MOD = 10**9 + 7
  
  
  def main():
      sn = s_input()
      n = int(sn)
  
      compare_num = int(sn[0]) * 100 + int(sn[0]) * 10 + int(sn[0])
  
      if n == compare_num:
          print(n)
      elif n > compare_num:
          print(int(sn[0]) + 1 * 100 + int(sn[0]) + 1 * 10 + int(sn[0]) + 1)
      else:
          print(compare_num)
  
  
  if __name__ == "__main__":
      main()
  
problem_description: Statement
  
  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?
samples: [{"input": "111", "output": "111\n    \n\nThe next ABC to be held is ABC 111, where Kurohashi can make his debut.\n\n* * *"}, {"input": "112", "output": "222\n    \n\nThe next ABC to be held is ABC 112, which means Kurohashi can no longer\nparticipate in ABC 111. Among the ABCs where Kurohashi can make his debut, the\nearliest one is ABC 222.\n\n* * *"}, {"input": "750", "output": "777"}]