Problem1015--Reverse Polish notation

1015: Reverse Polish notation

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MiB

Description

Reverse Polish notation is a notation where every operator follows all of its operands. For example, an expression (1+2)*(5+4) in the conventional Polish notation can be represented as 1 2 + 5 4 + * in the Reverse Polish notation. One of advantages of the Reverse Polish notation is that it is parenthesis-free.

Write a program which reads an expression in the Reverse Polish notation and prints the computational result.

Input

An expression is given in a line. Two consecutive symbols (operand or operator) are separated by a space character.

You can assume that +, - and * , / are given as the operator and an operand is a positive integer less than 106 ( the result of / is guaranteed integer)

2 ≤ the number of operands in the expression ≤ 100
1 ≤ the number of operators in the expression ≤ 99
-1 × 109 ≤ values in the stack ≤ 109

Output

Print the computational result in a line.

Sample Input Copy

1 2 + 3 4 - *

Sample Output Copy

-3

Source/Category