|
||||||||||
LotteryTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 230 Accepted Submission(s): 5 Special Judge Problem Description Your living city is holding a big lottery game now! There are M people in this city who want to play this lottery. Everyone of them must pay C dollars to get a lottery ticket. Taking this ticket, he can get a chance to win a prize by randomly selecting one from N indistinguishable boxes and getting the prize if there is a ball in the selected box. The ball in the selected box is also taken by this winner, so if a box with a ball happens to be selected by a player, it will never contain balls from then on, but it will be closed and can be selected by the future players. Every box contains exactly one ball at the beginning, and two or more players cannot select the boxes and the same time. Of course, the latter you join this game, the less the chance you win a prize will be. So the lottery holder make such a rule: If you are the n-th player who wins a prize, you will get A*(n-1)+B dollars. That is to say, the first winner will get B dollars, the second winner will get A+B dollars, the income of the third winner is 2*A+B, and so on. Being curious about the expected profit, the lottery holder is too lazy to calculate it himself. So he finds you and give you a lot of money to do this work. If you can solve it quickly, you will be a millionaire! Input The first line of input is a integer T, the number of test cases. Each case contains exactly 5 integers M, N, C, A, B in this order, where 1 <= M, N <= 10^6 and 0 <= C, A, B <= 100. Output For each test case, print a line contains a single real number which is the expected profit got. You can output the result with any precision you like, but the relative error should less than or equal to 1e-5. Sample Input
Sample Output
Author wywcgs Source | ||||||||||
|