409866: GYM103811 J Just Skip It

Memory Limit:256 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

J. Just Skip Ittime limit per test0.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Justin likes watching videos on the video-sharing platform PuiLaTube.

Recently, he thinks PuiLaTube is putting more advertisements in videos. He categorizes the advertisements into 3 formats, as shown in the following:

  1. Skippable video ads
    • Skippable video ads allow viewers to skip ads after 5 seconds.
    • Plays in video player. At least 12 seconds in length, at most 6 minutes (option to skip after 5 seconds).
  2. Non-skippable video ads
    • Non-skippable video ads must be watched before a video can be viewed.
    • Plays in video player. 15 or 20 seconds in length, depending on regional standards.
  3. Bumper ads
    • Short, non-skippable video ads of 6 seconds that must be watched before a video can be viewed.
    • Plays in video player, 6 seconds long.

Every time Justin clicks into a video, either no advertisement is shown, or one of the above types of advertisement is shown. The same thing happens when he refreshes the page.

Justin mastered the skill to check on the type of advertisement and discerning them in negligible time. He could also refresh immediately (in negligible time) by pressing F5 depending on the type of advertisement. It takes $$$1$$$ second to refresh the page.

By looking up the documentation, Justin obtains the probabilities of each type of video advertisement appearing. The probabilities stay constant even if you refresh the page.

As a self-proclaimed PuiLaTube expert, Justin would adopt an advertisement refreshing strategy that minimizes the expected time of waiting before he can finally watch the video. Of course, he would skip any Skippable video ads immediately after 5 seconds if he decides to not refresh.

Can you find the minimized expected time?

Input

The first line includes 5 integers, $$$p_0, p_5, p_{15}, p_{20}, p_6$$$ ($$$0 < p_0 \leq 100$$$, $$$0 \leq p_5, p_{15}, p_{20}, p_{6} \leq 100$$$).

$$$p_0 \%$$$ represents probability of no advertisements are shown. $$$p_5 \%$$$ represents probability of Skippable video ads is shown. $$$p_{15} \%$$$ and $$$p_{20} \%$$$ represents probabilities of $$$15$$$ seconds and $$$20$$$ seconds Non-skippable video ads is shown respectively. $$$p_6 \%$$$ represents probability of Bumper ads is shown.

It is guaranteed that $$$p_0 + p_5 + p_{15} + p_{20} + p_{6} = 100$$$, and at least one of $$$p_{15}$$$ and $$$p_{20}$$$ is $$$0$$$.

Output

Output a single line containing a single real number, the minimized expected waiting time before Justin could watch the video (in seconds).

Your answer is considered correct if its absolute or relative error, whichever is less, is not greater than $$$10^{-6}$$$.

ExamplesInput
50 0 50 0 0
Output
1.0
Input
15 25 0 35 25
Output
4.625000
Note

Consider the first example. Only 15 seconds of Non-skippable video ads may be shown with a $$$50\%$$$ probability.

If you choose not to refresh, the expected time is $$$50\% \times 15 = 7.5$$$ seconds.

If you choose to refresh one time, the expected time is $$$50\% \times (1 + 50\% \times 15) = 4.25$$$ seconds.

If you choose to refresh two times, the expected time is $$$50\% \times (1 + 50\% \times (1 + 50\% \times 15)) = 2.625$$$ seconds.

If you choose to refresh until there is no advertisement, the expected time is $$$50\% \times (1 + 50\% \times (1 + ...)) = 1$$$ second, which is the minimum expected time.

加入题单

算法标签: