410668: GYM104072 F Lucky Coins

Memory Limit:1024 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

F. Lucky Coinstime limit per test0.5 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard output

After losing a lot of money recently, you are desperately looking for ways to earn some. Today is your lucky day! Your generous friend proposes a game: He has a bag of coins, of which $$$N$$$ are green and $$$M$$$ are red. With equal probability, you draw one coin. If it is green, you earn $$$X$$$ euros, if it is red, you lose $$$Y$$$ euros. You can play this game as long as there are coins in the bag, or you can stop whenever you want and leave with your current earnings (or losses).

Given that you play optimally (you want to earn as much as you can), what is the maximum expected value of money you can earn?

Input

The first line of the input contains the integers $$$N$$$ ($$$1 \leq N \leq 2000$$$), $$$M$$$ ($$$1 \leq M \leq 2000$$$), $$$X$$$ ($$$1 \leq X \leq 10^9$$$) and $$$Y$$$ ($$$1 \leq Y \leq 10^9$$$), denoting the number of green coins, the number of red coins, how much money you earn if you draw a green coin and how much money you lose if you draw a red coin.

Output

On a single line, print the maximum expected value you can get if you play optimally. Your answer will be considered correct if the absolute or relative difference between your answer and judge's answer is less than $$$10^{-7}$$$.

ExampleInput
1 2 4 3
Output
1.00000000

加入题单

算法标签: