P13560 [CodeChef] bao
NOI
题目描述

Problem description
John and Dave are two close friends. One day John bluffs to Dave that in past some weeks he has learnt to program using any programming languages. Dave started laughing wildly on John but John insisted that he can really do programming. Then Dave decided to test John programming skills by giving him an easy program to develop. The question is to perform four operations on a given number. The four operations which needs to be performed are addition (+), subtraction (-), multiply (*) and division (/). The operation needs to be specified in a format. The format is “<operation to be performed><second number>” without double quotes. For example- if the user inputs “+5” (without double quotes) then 5 will be added to the given number. John searched the program on internet and easily found the solution and showed the same to Dave.
But for a twist Dave said that there can be any no of whitespaces before the operation to be performed, between the operation and the second number and after the second number. For example- if the user inputs “   +    5   "(without double quotes) then also 5 will be added to the given number. When John tried to find a solution on Internet he failed. You (an experienced programmer) as a friend of John help him to solve this problem.

Input
First line of input will be t, no of test cases.
Each test case begins with a line containing an integer N (Number of operations) and the first Number on which the operations will be performed. The next ith line contain the operation to be performed along with the second number. After each operation the next operation will be performed on the result of the previous operation.

Output
For each test case print the final number which will be the result of performing the last specified operations on the result of the previous specified operation with exactly 2 decimals of precision on a single line.

Constraints
0 < t < 100
0< N < 1000
First Number, the result of any intermediate operation and the final number will never exceed 1000000000

Example
Input:
2
2 12
+5
* 2
2 2.13
+ 0.2
/ 2
Output:
34.00
1.17

Note
Maintain 2 decimals of precision after every intermediate operation.

输入格式

见题面

输出格式

见题面

样例输入
2 2 12 +5 * 2 2 2.13 + 0.2 / 2
样例输出
34.00 1.17