import Data.List

sameAll :: String -> Bool
sameAll [x1, x2] = x1 == x2
sameAll (x1:remains@(x2:xs))
  | x1 /= x2  = False
  | otherwise = sameAll remains

main :: IO ()
main = do
  number <- readLn
  putStrLn $ head $ filter sameAll $ map show ([number..] :: [Int])