410668: GYM104072 F Lucky Coins
Description
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?
InputThe 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.
OutputOn 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}$$$.
ExampleInput1 2 4 3Output
1.00000000