#t430. 逆波兰表达式求值

逆波兰表达式求值

Reverse Polish Notation

Problem Description

Read a reverse Polish (postfix) expression from the keyboard. It contains only operands made of digits 00-99 and the four operators plus (+), minus (—), multiply (*), divide (/). Operands are separated by a single space. You do not need to validate whether the given expression is legal. Use @ as the terminator.

For example, 16–9*(4+3) becomes the postfix expression 16 9 4 3 +*–@.

The result is -47.

Hint: the input string has length less than 250; the absolute value of every integer involved and of the result is within 2642^{64}; any division is guaranteed to divide exactly.

Input Format

A postfix expression.

Output Format

The value of the postfix expression.

Sample Input

16 9 4 3 +*-@

Sample Output

-47

Limitation

1 s, 1024 KiB for each test case.