Glass Bead Game
题号:NC236485
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
Special Judge, 64bit IO Format: %lld

题目描述

"Abstractions are fine, but I think people also have to breathe air and eat bread.'' is a quote from Das Glasperlenspiel, or The Glass Bead Game, a novel published in 1946 written by the German author Hermann Hesse.

You are playing with n distinct glass beads in some order. In each step, you move exactly one bead to the front. The cost of moving the bead to the front is the number of beads before that bead. For example, if we move in the list the total cost is 3 and the resulting sequence of beads is .

Suppose that at each step glass bead is moved with probability , where . What is the limit of the expected cost of the m-th move, when m tends to infinity?

输入描述:

The first line contains an integer n ().

The second line contains n real numbers each with 6 digits of precision.

输出描述:

Output one real number, the answer.

Your answer will be considered correct if its absolute or relative error does not exceed . Formally let your answer be a, jury answer be b. Your answer will be considered correct if .
示例1

输入

复制
2
0.500000 0.500000

输出

复制
0.500000000000000
示例2

输入

复制
3
0.500000 0.250000 0.250000

输出

复制
0.916666666666667