9312 - Postfix Evaluation   

Description

Evaluate the result of a given numerical expression written in postfix notation.

Input

There are many test cases. Each line represents a test case.

Each line has a numerical expression written in postfix notation, and the number of “characters” in a line will not greater than 10^5.

Every number in input will fit in 32-bit signed integers.
The operators contain only “+”,”-“,”*”and”/”, and the division “/” here is considered as integral division.

Output

The output of each test case occupies a line. Each line begins with the test case number”Case i:”, and then a space character followed by the evaluated answer.
The answer will fit in 64-bit number.
However, if the expression is invalid, please print “Case i: error!”.
It’s guaranteed that in the first and second test case, there are all valid expressions.

9312 : all expressions are valid.
9313 : all expressions are valid.
9314 : some expressions are invalid.
9315 : some expressions are invalid.

Sample Input  Download

Sample Output  Download

Tags




Discuss