#K38892. Evaluate Reverse Polish Notation

    ID: 26299 Type: Default 1000ms 256MiB

Evaluate Reverse Polish Notation

Evaluate Reverse Polish Notation

You are given a valid mathematical expression in Reverse Polish Notation (RPN). In RPN, every operator follows all of its operands. For example, the expression 3 4 + is evaluated as 3 + 4. Supported operators are +, -, *, and /. Division is performed as integer division. You are required to compute the result of the given expression.

Note: The input will be a single line with tokens separated by spaces, and you should print the evaluated result as an integer.

For instance, the expression \[ 3\ 4\ +\ 2\ *\ 7\ / \] should output
2 because it is equivalent to \( ((3+4)\times 2)/7 \) using integer division.

inputFormat

The input consists of a single line containing a valid RPN expression. Each token (number or operator) is separated by a space.

outputFormat

Output a single integer which is the result of evaluating the RPN expression.

## sample
3 4 +
7