Two long-time rival football teams, let us call them (for beautiful manners) and (for miserable — very, very miserable — manners), are playing again. Both teams are exhausted, so the first to score a goal will win the game for sure. At this moment, team has the ball. If they decide to attack, there is a probability that they manage to score, thus winning the game. Hovewer, with probability they will receive a goal, thus losing the game. With probability they will just lose the possesion of the ball. Team has another option: to pass the ball around. In that case, the possesion of the ball will eventually go to team . Then we will have a simmetrical situation: If team goes for an attack, they will immediately win with probability , they will immediately lose with probability , and the ball will go back to team with probability . If they decide to just pass the ball and wait, eventually the possesion of the ball will go back to team .
0.55
Given , , and , and assuming that both teams take the best decisions (to attack or not to attack) and that team has the ball now, which is the probability that team will win?
Input consists of several cases, each one with four real numbers , , and between 0 and 1. Assume and .
0.45
For every case, print the probability that team
will win with four digits after the decimal point. (The input cases have
no precision issues.) A situation where no goal will be scored (an
eternal tie) is similar to a fifty-fifty situation. Consequently, print
“0.5000” in this case.
Input
1 0 0.7 0.2 0.3 0.6 1 0 0 0 0.3 0.6 0 0 0.1 0 0.4 0.2 0 1 0 1 0.4 0.2 0.4 0.2 0.4 0.2 0 0 0 0
Output
1.0000 0.3000 0.5000 0.0000 0.6667 0.3333 0.5714 0.5000