import Control.Applicative
import Data.List

main :: IO ()
main = do
    ns <- map read . words <$> getLine
    putStrLn $ show (solve (sort ns))

solve :: [Int] -> Int
solve (n:ns) = n + (head ns + (last ns) * 10)