import Data.List

main :: IO()
main = getLine >>= print.(\xs -> foldl1' (calc $ last xs) $ f (init xs) ).words
    where f []           = []
          f [x, y]       = [read x, read y]
          f (x:y:ope:xs) = calc ope (read x) (read y) : f xs

calc     :: String -> Int -> Int -> Int       
calc "+" = (+)
calc "-" = (-)
calc "*" = (*)