Limits 1s, 512 MB

Swimming is a very good exercise which burns body fat very quickly and also helps improve stamina. Most exercises concentrate on a particular aspect, for example, weight training increases muscle mass, aerobic exercises reduce body fat, acrobatics make the body more flexible and fit. Swimming does all these and much more. However, swimming does not come naturally to people, unlike animals who are born swimmers. Learning swimming is like learning how to ride a bicycle, studying and researching produces very minimal results and takes up a lot of time, while practicing and experiencing leads to a shorter and enjoyable learning period. Although, when a nerd tries to learn swimming, that is a different story altogether.

Tasneea is such a nerd and she wants to calculate the entire body movement when a person is swimming. Calculating most of the body movement is quite easy for her as she is, after all, a nerd. What causes the most trouble for her, is calculating the circular hand movement. She knows that the maximum hand movement speed achievable by a swimmer in the air is A ms-1 and the maximum hand movement speed achievable underwater is W ms-1. Given such information, help her find out how fast a human being can swim if, for each hand rotation, the swimmer swims a distance of S m. A full hand rotation is completed when one hand starts from a position above or underwater and reaches the same position again. The length of the swimmer's hand is L m and there is no water current (as the swimmer is in a swimming pool). Assume that the hand remains straight throughout the process and half of the circular motion is completed in the water while half is completed above water. The swimming style followed by the swimmer is freestyle stroke ( or front crawl ) as given in figure.


Input will start with the number of test cases T followed by T lines of integers - A, W, S, and L. Here 1 ≤ T, A, W, S, L ≤ 105.


For each test case, print the case number and only one value, the maximum possible swimming speed X in ms-1 upto a precision value of 10-6. See the sample input and output format for better understanding.


3 2 1 1
Case 1: 0.381972


Login to submit.


60% Solution Ratio
StarscreamEarliest, Oct '19
waheg62061Fastest, 0.1s
StarscreamLightest, 2.6 MB
mdvirusShortest, 137B
Toph uses cookies. By continuing you agree to our Cookie Policy.