F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Math

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 739    Accepted Submission(s): 176
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
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-29 11:00:13, Gzip enabled