module Main where

import Control.Applicative
import Control.Monad
import Data.List

main :: IO ()
main = do
    n <- readLn :: IO Int
    let ans = head $ filter (>= n) [111, 222 .. 999]
    print ans