Expression
In the country of Olympia, numerical expressions are written using a specific format:
Expressions are composed of operands and operation symbols, separated by spaces.
Operands are positive integers.
Operations include addition (represented by the
+
symbol) and multiplication (represented by the*
symbol).Expressions are evaluated from left to right. When an operation symbol is encountered, the operation is performed on the two most recent operands preceding it. The result then replaces the operands and the operation symbol in the expression, and the evaluation continues following this rule.
The final result of the expression is the outcome of the last operation performed.
For example, consider the expression 3 4 2 * +
:
The first operation is multiplication (
*
), applied to the two preceding numbers (4
and2
), yielding8
. This replaces the sequence4 2 *
, resulting in the expression3 8 +
.Next, the addition (
+
) operation is performed on the preceding numbers (3
and8
), yielding11
, which replaces3 8 +
.
With no further operations, the evaluation is complete, and the result of the expression is 11
.
The value of any expression is guaranteed to be between 0
and 2000000000
.
Input Data
The input file contains an expression made up of positive integers and operation symbols, separated by spaces. The expression can be up to 10000
characters long.
Output Data
The output file will contain a single number, which is the result of evaluating the expression.