Hide

Calculator

Input

Input contains several test cases, one per line. Each test case consists of an expression to be evaluated, containing numbers, parentheses, and the operators $+,-,*,/$.

Normal operator precedence applies, so multiplication and division bind harder than addition and subtraction. All operators evaluate left-to-right. Implicit multiplication is not possible, so $3(1+1)$ is not a valid input. There may be an arbitrary amount (including $0$) of spaces between tokens. Numbers are integers with absolute value at most $500$.

Input is terminated by end of file.

Output

For each test case, output the value of the expression, with two digits of precision after the decimal point.

Sample Input 1 Sample Output 1
5 - 3-2
5- (3-2)
5 / 3 / 2
5 / (3 / 2)
1/3+1
1/(3+1)
-4--2
(1-3)/(5+4)
2*3*5*7*11*13*17*19
-5/-5
0.00
4.00
0.83
3.33
1.33
0.25
-2.00
-0.22
9699690.00
1.00

Please log in to submit a solution to this problem

Log in