{-# OPTIONS_GHC -Wall #-}

readInt :: String -> Int
readInt = read

process :: [Int] -> String -> [Int]
process (r:l:xs) "+" = l+r : xs
process (r:l:xs) "-" = l-r : xs
process (r:l:xs) "*" = l*r : xs
process xs s         = readInt s : xs

main :: IO ()
main = do
    tokens <- fmap words getLine
    let ans = head $ foldl process [] tokens
    print ans

