Dabbu the Entrepreneur

shajia Criterion 2020 Round 4
Limits 1s, 512 MB

Dabbu is back from Cox’s Bazar with an obsession with Coconut. Nowadays he is so obsessed with coconut that he has bought a coconut tree. Because He has a plan to eat more coconut water as it is very good for health and it revives the inner beauty of the skin. He also has a plan to start a business with coconut. In this situation, all of a sudden, his coconut tree was broken by the storm one day. At first, Dabbu became very sad. Seeing him sad, his mother, who is a competitive programmer, suggested a solution. She told Dabbu that if Dabbu can find the length of the broken part, she will give him some money as a reward.

Now, Dabbu is very eager to find the length of the broken part. But he has limited information to retrieve the length. Help Dabbu solve this problem. Because if you help him, he will get the money from his mother and will start a coconut business.

The coconut tree has broken in a way that from the ground point AA of the tree, it has broken on point BB and the peak of the tree has fallen on the ground on point DD creating an angle ABDABD. The tree was initially standing perpendicular to the ground.

You will be given the length from point DD (the peak of the tree that fell on the ground) to point AA (the root of the tree) and the angle created on the broken part of the tree. Now help Dabbu become an entrepreneur!

Input

The first line of the input contains an integer TT (1T5000001 \le T \le 500000), the number of test cases. Then, for each test case, there will be two real numbers dd (1d50001 \le d \le 5000), a (0<a45)0 < a \le 45) the distance from DD to AA and the angle ABDABD respectively.

Output

In the output, print the length of the tree. Errors less than 10410^{-4} will be ignored.

Sample

InputOutput
1
10 30
37.320508

Submit

Login to submit.

Statistics

92% Solution Ratio
EgorKulikovEarliest, Mar '20
Salman.306242Fastest, 0.2s
smak_9Lightest, 3.5 MB
imamanik05Shortest, 109B
Toph uses cookies. By continuing you agree to our Cookie Policy.