Author: | N. Grebenyuk, A. Usmanov. Translation: A. Logutova. | Time limit: | 2 sec | |
Input file: | Standard input | Memory limit: | 512 Mb | |
Output file: | Standard output |
Trolls surrounded Gandalf the Grey in a cave. Initial distance between the wizard and the nearest troll is R meters. Trolls run T meters every second. At the end of each second Gandalf throws the trolls back to D meters by the magic ring of light.
But there is a problem — angry Saruman the White cursed Gandalf's staff, and now it works only with some probability P.
The trolls will turn into the stone when sunshine lights up the room. Gandalf needs to know how many chances he has to stay alive until the sunrise. Sunrise time is S seconds. Gandalf will die if the distance between him and trolls become less than 1 meter before sunrise.
The first line contains four integers R, D, T, S.
The second line contains a real number P. P is given with at most 5 digits after the decimal point.
Print a real number — probability that Gandalf will stay alive until dawn.
Your answer will be accepted if it has absolute error at most 10 − 5. More specifically, if your answer is a and the jury answer is b, your answer will be accepted if |a − b| ≤ 10 − 5.
1 ≤ R ≤ 50000
1 ≤ D, T ≤ 100
1 ≤ S ≤ 500
0 ≤ P ≤ 1
No. | Standard input | Standard output |
---|---|---|
1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|