import Data.List
import Control.Applicative
entry = (intercalate " ") . (show <$>) . solve . ((read :: String -> Integer) <$>) . words
solve = (<$> [(*), ((2*) .) . (+)]) . (flip foldr1)
main = getLine >>= return . entry >>= putStrLn