Home STD Contest Notification Clarification Problems Ranklist Status Print Sign Out

Math

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 83    Accepted Submission(s): 6
Special Judge


Problem Description
Avin sells robots to clients. At second 0, Avin is at the location (0,0) on a number axis with a robot.
He wants to go to (L, 0) with the robot. He walks a unit distance per second, and he can only stop at integer coordinates. Now, he decides to follow these walking rules repeatedly until he arrives (L, 0) with the robot:
1) If Avin has the robot with himself, the robot may be dropped down with probability p.
2) If Avin had dropped the robot, he will figure it out with probability q. Specially, if Avin arrives at (L, 0) without robot, he will turn around immediately.
3) If Avin does not see that the robot had been dropped, he walks one step right; otherwise, he walks left until he is at the same location as the robot.
What is the expectation of walking time he needs to arrive (L, 0) with the robot?
 

Input
One line with three numbers L, p and q, where L (1 ¡Ü L ¡Ü 100, 000) is an integer, p and q are real numbers with three digits and within (0, 1).
 

Output
Print the expected walking time. Your answer is considered correct if the absolute or relative error doesn¡¯t exceed 1e6 . Formally, let your answer be a, and the jury¡¯s answer be b. Your answer is considered correct if $\frac{|a-b|}{max(1,|b|)} $ ¡Ü 1e-6.
 

Sample Input
1 0.500 0.500
 

Sample Output
2.0000000000
 

Statistic | Submit | Clarifications | Back