Proficiency

Given two counters with geometric service times, find the probability that all L1 people finish before all L2 people do.

Medium7ProbabilityDynamic programmingMathNo attempts yetTime limit2sMemory limit512 MB

Problem

Yeongseon has finished shopping and walks to the checkout. There are two counters. L1L_1 people stand in line at counter 1 and L2L_2 people stand in line at counter 2. Each clerk serves the person at the front of the line, one person at a time.

The time a clerk needs for one person depends on the clerk's proficiency. A clerk with proficiency pp finishes one person in exactly kk seconds with probability 1p(11p)k1\frac{1}{p}\left(1 - \frac{1}{p}\right)^{k-1}. The clerk at counter 1 has proficiency P1P_1, the clerk at counter 2 has proficiency P2P_2, and the times are independent across people.

Given L1L_1, L2L_2, P1P_1, P2P_2, compute the probability that standing in line at counter 1 is better than standing in line at counter 2. That is the probability that the last person in line 1 finishes before the last person in line 2. Finishing in the same second does not count as finishing first.

Input

The first line contains L1L_1, L2L_2, P1P_1, P2P_2 separated by spaces. (1L1,L2,P1,P210001 \le L_1, L_2, P_1, P_2 \le 1000)

Output

Print the probability that the last person at counter 1 finishes before the last person at counter 2, rounded to nine decimal places. Always print exactly nine digits after the decimal point. If 000^0 comes up while computing the probability, treat it as 1.