407131: GYM102697 102 Pocket Calculator

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

102. Pocket Calculatortime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Pocket Calculator

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.

Input

The 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.

Output

Output 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.

ExamplesInput
7 + 5
Output
12
Input
3 - 6 * 3
Output
-15
Input
3 + 4 * 3 - 6 / 3 * 3
Output
9
Note

In the third sample, $$$9.0$$$ would also be judged as correct.

加入题单

上一题 下一题 算法标签: