URI Online Judge | 1605

Building Your Own Cafila

By Gabriel R. C. Peixoto Brazil

Timelimit: 2

Camels have been domesticated and they are used by the Bedouin people for several millennia. There are two main types, the bactrian camel with two humps, which are rare, and dromedaries, most common, with only one hump. For simplicity, the bactrian camels are called only camels.

Dromedary and camels have different interesting characteristics: some are born leaders, others have more strength, others support longer walks, etc. However, each animal has only one of these characteristics. A caravan needs animals with several of these characteristics. In the market of these animals N1 different characteristics for dromedary and N2 different characteristics for camels are considered.

The Bedouins always sell these animals in cafilas formed by groups of three. This is a Berber tradition that dates back to the ninth century, when traders of camels and dromedaries could only sell their animals that way. Buyers can not choose the animals. Lots of 3 animals are prepared by the seller and the buyer can just say the batch number that he wants to buy, no more information about it is given. Traders are known for their extreme honesty, and each batch is formed randomly. For each animal of the batch, the dealer draws with probability p1 if it will be a dromedary and with probability p2 = 1 - p1 if it will be a camel, p1 ≥ p2. Chosen the type of animal, a characteristic is chosen from among the Ni, with equal probability, and an animal with this characteristic is included in the batch.

All sweepstakes of the trader are independent, a batch can contain two strong droomedaries and a leader camel, for example, or even three good walking camels. However, attest to his honesty, whenever the dealer produces a batch that has only dromedaries he makes a new draw. Among the characteristics to N1 dromedaries, there M1 which are desirable to the purchaser.

Among the N1 characteristics of camels, there are M1 which are desirable to the purchaser. And among the N2 characteristics of camels, there are M2 which are desirable to the purchaser. What is the expected number of lots that a buyer should acquire to build a cafila that has dromedaries and camels with all M1 and M2 desired characteristics?

Input

The input consists of several instances and ends with the end of file (EOF).

Each instance consists of 3 lines, each containing two integers. In the first line we have N1 and N2 (1 ≤ Ni ≤ 50). The second line consists of M1 and M2 (0 ≤ MiNi), while the third line has W1 and W2 (1 ≤ W2W1 ≤ 100), which gives the probability of each category according to:

Output

For each instance print a line containing a number with 2 decimal places, which it is the number expected of lots that the purchaser needs to buy to complete his cafila.

Sample Input Sample Output

1 1

0 0

1 1

1 7

1 0

1 1

5 5

3 2

11 6

0.000

1.167

7.677