Hide

Sunshine

The weather in Stockholm has been unusually good during the last month. There have been a few showers of rain the last few days, but I’m sure we had a streak of something like 20 days of constant sunshine in a row.

Now, we’re interested in knowing how likely this is to happen again. We have weather prognosis data for the next $N$ days, that tell us how likely it is that each day will be sunny. We assume that these events are independent of each other.

What is the probability of having a streak of $K$ days in a row of sun during these $N$ days?

Input

The first line of input contains the two integers $N, K$ ($1 \le K \le N$). The second line of input contains $N$ real numbers $p_ i$ ($0 \le p_ i \le 1$) – the probability of each day being sunny.

Output

Output a single number – the probability of having a streak of $K$ days in a row of sun during the $N$ days. The answer should have an absolute or relative error of at most $10^{-6}$.

Scoring

Your solution will be tested on a set of test groups, each worth a number of points. To get the points for a test group you need to solve all test cases in the test group. Your final score will be the maximum score of a single submission.

Group

Points

Constraints

1

15

$N \le 1000$

2

20

$N \le 4 \cdot 10^5$

Sample Input 1 Sample Output 1
5 2
0.1 0.2 0.3 0.4 0.5
0.307200000000000000

Please log in to submit a solution to this problem

Log in