import Control.Applicative
import Debug.Trace

calc :: [String] -> String
calc xs = loop xs $ words "_ _"
  where
    loop [] (y : _) = y
    loop (x : xs) ys@(a : b : ys')
      | x == "+" = loop xs ((calc' (+) b a) : ys')
      | x == "-" = loop xs ((calc' (-) b a) : ys')
      | x == "*" = loop xs ((calc' (*) b a) : ys')
      | otherwise = loop xs (x : ys)
      where calc' obj x y = show (obj (read x) (read y))

main :: IO ()
main = do
  ss <- words <$> getLine
  putStrLn $ calc ss

