import Control.Applicative ((<$>)) import Data.Char (isDigit) main :: IO () main = solve <$> getLine >>= print solve :: String -> Int solve s = f (read as) bs where (as, bs) = span isDigit s f n [] = n f n (op:rs) | op == '*' = f (n + (read cs)) ds | otherwise = f (n * (read cs)) ds where (cs, ds) = span isDigit rs