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

toInt :: (String -> Int)
toInt x = read x ::Int

getInts = do
  x <- getLine
  let y = (map$toInt)$words x 
  return y

getStr = do
  x <- getLine
  let y = words x 
  return y  

main :: IO ()
main = do
  x <- getInts 
  let a = sort x
  let b = splitAt 1 a
  let f = fst b
  let s = snd b
  print $ (foldl (+) 0 $ map (\x -> snd x * 10^(fst x)) $ zip [0..((length s)-1)] s) + head f
