A test bench logs circuit voltage adjustments as a postfix (Reverse Polish Notation) expression. Each token is either an arithmetic operator (+, -, *, /), given as a single standalone character, or an integer literal (which may be negative, e.g. -7; a negative literal always has more than one character, so it is never confused with the - operator token).
Evaluate the expression using the standard postfix rule: scan tokens left to right while maintaining a stack of values. Each operator pops its two most recently pushed values (the one popped second is the left-hand operand, the one popped first is the right-hand operand), applies itself, and pushes the result back. Division truncates toward zero (like integer division in C or Java), e.g. -7 / 2 evaluates to -3.
It is guaranteed that the tokens form a single valid, fully-reducible postfix expression, and that division by zero never occurs.
Input format
Line 1: an integer n, the number of tokens.
Line 2: n space-separated tokens.
Output format
A single integer: the value left on the stack after evaluating the whole expression.
Constraints
- 1 ≤ n ≤ 99
- Each integer literal has absolute value ≤ 1000000.
- The expression is a valid postfix expression; division by zero never occurs.