“Stop War, Save Life” – A life-changing motto proposed by Peace Want Society (PWS).
To establish this motto the CEO of PWS Mr. Savior has to face several challenges. Being busy to get out from a weird map the evil guys set up another challenge. This time they want to let Mr. Savior eat. The evil guys make a rectangular dark forest cake. A honey drop has been placed on top of the cake. The evil guys connect all four corners by margarine stick with that honey drop. Let’s have a look at the picture below –
Here is the cake. The honey drop is placed on the point . Here , , , . The evil guys somehow managed to calculate the size of any three margarine stick. Mr. Savior has to figure out the size of the left margarine stick. Mr. Savior will encounter queries of 4 different types.
For the query of Type – 1, Mr. Savior will be given the value of , , . He has to find the value of .
For the query of Type – 2, Mr. Savior will be given the value of , , . He has to find the value of .
For the query of Type – 3, Mr. Savior will be given the value of , , . He has to find the value of .
For the query of Type – 4, Mr. Savior will be given the value of , , . He has to find the value of .
Input starts with an integer () which denotes the number of test cases. Each of the next lines contains four integers. The first integer () denotes the query type. The second, third and fourth integer will be the values of either , , or , , or , , or , , () based on the query type as described above.
Input will be given as such the answer will always be valid.
For each test case, you need to print the size of the margarine stick that is not given in the input in the following format. Errors will be ignored after 4 decimal points.
Input | Output |
---|---|
2 4 4 6 5 3 4 6 5 | 2.2361 6.7082 |