407131: GYM102697 102 Pocket Calculator
Description
You have a pocket calculator. Unfortunately, it is broken, so you need to calculate large math operations yourself. For this problem, you need to write a computer program to calculate the answer to a long math operation, with multiplication (denoted by an asterisk *), division (denoted by a slash / ), addition, and subtraction. There will not be parentheses or exponents. Recall order of operations: multiplication and division (with equal weight) from left to right first, followed by addition and subtraction (with equal weight) from left to right. Using eval() or similar commands for this problem is not allowed.
InputThe only line of input contains a line of text representing a math operation to calculate. The math operation will consist of one-digit numbers and the four operations described above, with exactly one space between each one. The input line will start and end with a number, and there will not be an equals sign at the end of the operation.
OutputOutput a single integer: the answer to the math operation. The answer is guaranteed to fit inside of a 32-bit signed integer type. The answer is also guaranteed to be an integer.
ExamplesInput7 + 5Output
12Input
3 - 6 * 3Output
-15Input
3 + 4 * 3 - 6 / 3 * 3Output
9Note
In the third sample, $$$9.0$$$ would also be judged as correct.