#Lutece1158. Game of OOXX

Game of OOXX

Migrated from Lutece 1158 Game of OOXX

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

One day, Bob was playing an OOXX Game with his girl friend Alice. Bob was trying to make Alice laugh and happy. So, he decided to tell NN jokes to Alice. Some of his jokes were funny and Alice laughed out loud. However, some of them were very boring and Alice didn't like it.

Let's mark the Game they had played as a String S. Each character of String S is either an 'O' or an 'X'. The length of String is exactly NN. If SiS_i='O', that means Alice liked ithi^{th} jokes Bob had told. Otherwise, if SiS_i='X', that means Alice disliked it.

We can grade for Bob by following rules. We find each long consecutive substring of S which only contains 'O' and add the square of its length to the score. For example, S="OOOXXOOXXOOO", we can find three long consecutive substring of S which are "OOO", "OO" , "OOO". Each of their length is 3, 2, 3. So the final score we grade for Bob is 32+22+32=223^2+2^2+3^2=22.

Now, I would like to give you the possibility of each joke Alice liked. Please tell me the expected score we will grade for Bob.

Input

The first line contains an integer NN(1N1051 \leq N \leq 10^5), meaning the number jokes Bob had told.

The following line contains NN real number p1,p2,...,pNp_1, p_2, ... ,p_N(0pi10 \leq p_i \leq 1), meaning the possibility of each joke Alice liked.

There will be at most six digits after the decimal point for each pip_i.

Output

Output a real number with 6 digits exactly after the decimal point indicating the expected score we will grade for Bob.

Samples

2
0.4 0.5
1.300000
3
0.000001 0.123456 0.654321
0.939338

Resources

2015 UESTC ACM Summer Training Team Selection (4)