Vampires

Given two life totals, a hit threshold and a fixed damage, find the probability that vampire 1 wins a turn-based drain fight.

Medium5ProbabilityDynamic programmingSimulationInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

Felipinho is hooked on his new RPG about wars between vampire clans. In the game he plays a vampire character who keeps fighting vampires from other clans. Each battle is decided by the attributes of the characters involved and by an ordinary six-sided die.

For simplicity, consider only fights between two vampires, vampire 1 and vampire 2. Each has a life energy, called EV1EV_1 and EV2EV_2 respectively. An attack strength ATAT and a damage value DD are also fixed.

The fight proceeds in turns as follows. Each turn the die is rolled. If the result is less than or equal to ATAT, vampire 1 wins the turn; otherwise vampire 2 wins it. The winner drains DD life energy from the opponent: the loser's energy decreases by DD and the winner's energy increases by DD. The fight continues until one of the vampires has an energy less than or equal to zero.

For example, suppose EV1=7EV_1=7, EV2=5EV_2=5, AT=2AT=2 and D=4D=4. The die is rolled and shows 3. Vampire 2 wins the turn, so 4 is subtracted from vampire 1's energy EV1EV_1 and added to vampire 2's energy EV2EV_2. The new values are EV1=3EV_1=3 and EV2=9EV_2=9. If vampire 2 wins the next turn as well, the fight ends.

ATAT and DD stay constant for the whole fight; only EV1EV_1 and EV2EV_2 change.

Felipinho loves the game, but he finds the fights far too long, and he would like to know his chance of winning in advance so he can decide whether a fight is worth it. Write a program that, given the initial values of EV1EV_1 and EV2EV_2 together with ATAT and DD, computes the probability that vampire 1 wins the fight.

Input

The input contains several test cases. Each test case is a single line with four integers EV1EV_1, EV2EV_2, ATAT and DD separated by spaces (1EV1,EV2101 \le EV_1, EV_2 \le 10, 1AT51 \le AT \le 5, 1D101 \le D \le 10).

The end of the input is marked by a line containing four zeros separated by spaces. Do not process this line.

Output

For each test case, print a single line with one real number: the probability that vampire 1 wins the fight, expressed as a percentage, with exactly one digit after the decimal point.

Round the exact probability to one decimal place. When the exact value lies exactly halfway (for example, exactly 56.2556.25), round up and print 56.356.3.