#C8825. Evaluate Prefix Expression
Evaluate Prefix Expression
Evaluate Prefix Expression
You are given an arithmetic expression in prefix notation. In this notation, every operator precedes its operands. The allowed operators are \(+\), \(-\), \(\times\), and \(\div\). The division operator performs integer division (i.e. the result of \(\frac{a}{b}\) is truncated towards zero).
Your task is to evaluate the given prefix expression and output the resulting integer.
Example:
Input: + 1 2 Output: 3
inputFormat
The input consists of a single line containing a valid prefix expression. The tokens (operators and operands) are separated by spaces.
outputFormat
Output a single integer, which is the result of evaluating the prefix expression.
## sample+ 1 2
3