Professor Oak is very strict. However, his two nieces are not aware of this fact. So, when he says “últim” (Catalan word for “last one”), this means in practice “not the last time” (that his nieces are doing whatever they are doing). When he says “superúltim”, this means “maybe the last time” (with probability , typically small). And when he says “últimsuperúltim”, this also means “maybe the last time” (but with probability ).
Supose that Prof. Oak says “últim”, “superúltim” and “últimsuperúltim” with independent probabilities , and , respectively, until their nieces stop. How many phonemes will Prof. Oak need to say on the average? Take into account that, for all those Catalan words, each letter corresponds to one phoneme.
Input consists of several cases, each one with the probabilities , , and . Assume , , , and .
For every given case, print with three digits after the decimal point the expected number of phonemes said by Prof. Oak. The input cases do not have precision issues.
Input
0.5 1 0 0 0.2 0.6 0.6 0.3
Output
15.000 62.500