All Submissions


You must have seen the song Main Hoon Don. The song starts with the scene where Isha Koppikar is pouring champagne in a pyramid of glasses. Have a look...Main Hoon Don
But we will consider a simplistic view of the structure like the one below.

Some volume of champagne V is poured in the topmost glass (1,1). All glasses have the same capacity C. When this glass gets filled, the extra amount overflows into the the two glasses below it (2,1) and (2,2) in equal amount. Similarly, when these glasses get filled, the extra champagne flows to the next level. All glasses, except the first glass and last glass of each row gets champagne from two glasses in the above row. For expamle, glass (3,2) get champagne both from (2,1) and (2,2) while glass (3,1) gets champage only from (2,1).

When Don comes, he holds his gun to your head and asks you to calculate the amount of champagne in the jth glass from left of ith row from top. If you don't answer correctly, you will surely be dead.

Input
The first line contains a single integer T, the number of test cases. T lines follow, each representing a seperate test case. These T lines conatins 4 integers V, C, i and j in order.

Output
For each test case, display a single line containg the amount of champagne in the jth glass from left of ith row from top rounded off to 2 decimal places.

Constraint
Assume there are more than i rows in the tower of glasses.
1 <= T <= 1000
1 <= V <= 10^5
1 <= C <= 100
1 <= i <= 100
1 <= j <= i

Sample Input
5
4 1 1 1
4 1 2 1
4 1 3 2
4 1 3 3
4 1 4 2


Sample Output
1.00
1.00
0.50
0.25
0.00


Problem Setter : Shikhar Sharad
Problem Tester : Arjun Singh Bhatia

Languages: Brain,C,C++,Java,Pascal,Perl,PHP,Python,Ruby,Text

Time Limit: 2 Second(s)
Score: 0 Point(s)
Input File Limit: 50000 Bytes

Submit

Login to post clarification.

No Clarifications.

Contest

Mode Judge

Passive

Online

Overall Rankings

RankNameScore
1xyz0
2Ams0
3TIP0
4team420
5xyzz0
6asdasdasd0
7abcd0
8khankhan0
9Gabriel0
10gigel0