#K58292. Evaluate Reverse Polish Notation

    ID: 30610 Type: Default 1000ms 256MiB

Evaluate Reverse Polish Notation

Evaluate Reverse Polish Notation

You are given an expression in Reverse Polish Notation (RPN) (also known as postfix notation). In this notation, every operator follows all of its operands. For example, to add 3 and 4, one would write "3 4 +" rather than "3 + 4".

Your task is to evaluate the given RPN expression and output the integer result. Note that division between two integers should truncate toward zero. It is guaranteed that the given RPN expression is valid and the result will fit in a 32-bit signed integer.

Example. For the RPN expression: 2 1 + 3 *, the expression evaluates to 9.

inputFormat

The input consists of a single line containing the tokens of the RPN expression separated by spaces.

Each token is either an integer or one of the operators +, -, *, or /.

outputFormat

Output a single integer which is the result of evaluating the RPN expression. The result should be printed to stdout.

## sample
2 1 + 3 *
9