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.
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.
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.
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
4 1 1 1
4 1 2 1
4 1 3 2
4 1 3 3
4 1 4 2
Problem Setter : Shikhar Sharad
Problem Tester : Arjun Singh Bhatia