Problem B
Expecting Rain
The Bluewater Geocloud Organization (BGO) has recently developed brand new software able to predict with pinpoint precision at which second any particular cloud will start and stop raining, and with what intensity. There is, however, some uncertainty about how a cloud will move around; for each zip code, each cloud will be over that zip code with some probability.
You have scraped some information about your zip code from
the BGO website, and want to use it to plan your walk to the
bus stop. You wish to minimize the expected amount of rain that
would fall on you. To reach the bus you must get to the bus
stop within
To complicate matters, some parts of the walk to the bus are
covered by roofs where it might be beneficial to make shorts
breaks whilst waiting for the worst rain to pass. Your front
door (at
Input
The first line of input is four space-separated integers:
-
( ) is an integer giving the number of seconds until the cloud starts its raining period, -
( ) is an integer giving the number of seconds until the cloud ends its raining period, -
( ) is a real number (with at most digits after the decimal point) giving the probability that the cloud is in your zip code during its raining period, and -
( ) is an integer indicating the amount of rain the cloud will release during its raining period, given as nm per second.
Finally
Output
The output consists of single a real value, the minimum
amount of rain in nm you can expect on your route if you reach
the bus stop in time. Answers with absolute or relative
precision
Sample Input 1 | Sample Output 1 |
---|---|
20 60 2 1 5 15 0.33333 30 22 60 0.66666 70 0 10 |
466.662 |
Sample Input 2 | Sample Output 2 |
---|---|
3 4 2 1 1 3 0.25 8 2 4 0.66667 15 1 2 |
10.00005 |
Sample Input 3 | Sample Output 3 |
---|---|
3 4 1 0 0 2 0.25 8 |
2.0 |
Sample Input 4 | Sample Output 4 |
---|---|
3 5 2 1 0 3 0.125 32 2 5 0.5 32 3 4 |
28.0 |