B - Arithmetic Expressions 

Context

Let's start with an easy problem. Given a set of arithmetic expressions, the goal of this problem is to obtain their evaluation values.

For instance, given the expression ( 3.00 + 4.50 ) its evaluation value will be the real value 7.50.

The Problem

Given a set of N arithmetic expressions, each of the form Real or ( Expression Op Expression ) with Op one of the following arithmetic operators: +, -, *, /, the goal is to obtain the evaluation value of each arithmetic expression.

The Input

The first line contains a natural number N that indicates the number of arithmetic expressions to evaluate, followed by the arithmetic expressions, each one in one of the following lines.

The following lines contain, each line, an arithmetic expression of real numbers of the form:

Observe that all the symbols (parenthesis, operators and numbers) are separated by spaces.

The Output

For each input case, the output will have a line with the real value obtained by evaluating its corresponding arithmetic expression. The real number will have two decimal digits, rounding to the nearest real value, without using floating point representation. For example: 0.005 is rounded to 0.01; 0.00499999 is rounded to 0.00; -0.005 is rounded to -0.01; and -0.00499999 is rounded and represented as -0.00. The evaluation value of an arithmetic expression will be a real value calculated as follows:

There will not be divisions by 0, and the absolute value of the result will not be greater than 2000000.

Sample Input

3
( 3.00 + 4.50 )
( 5.00 - ( 2.50 * 3.00 ) )
( ( 7.00 / 3.00 ) + ( 4.00 - ( 3.00 * 7.00 ) ) )

Sample Output

7.50
-2.50
-14.67

OMP'14
Facultad de Informática
Universidad de Murcia