시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 1024 MB25211986.364%

문제

Black and White is a Chinese children's game played in rounds. During each round, the children who are playing all put their hands in either face-up ("White") or face-down ("Black"). If all the children but one make the same choice, then the "odd one out" sits out for the rest of the game. Play continues until there are only two children left.

Each child independently chooses whether to put their hand face-up with their own fixed probability. What is the expected number of rounds that such a game will last?

입력

The first line contains a single integer $n$ ($2 \le n \le 20$), which is the number of children.

Each of the next $n$ lines contains a single real number $p$ ($0.1 \le p \le 0.9$). These are the probabilities for each child that they will put their hand in face-up. The probabilities will have at most three digits after the decimal point.

출력

Output a single real number, which is the expected number of rounds. The result must be accurate to within an absolute or relative error of $10^{-6}$.

예제 입력 1

3
0.5
0.5
0.5

예제 출력 1

1.3333333

예제 입력 2

3
0.3
0.3
0.3

예제 출력 2

1.5873015

예제 입력 3

5
0.1
0.3
0.5
0.7
0.9

예제 출력 3

7.4752846