407129: GYM102697 100 Ohm Sweet Ohm

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

Description

100. Ohm Sweet Ohmtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Ohm Sweet Ohm

You have a circuit consisting of many resistors in parallel, and you want to calculate their equivalent resistance, in ohms.

If you competed in our Contest #2 back in January, you might remember that the formula for calculating the equivalent resistance of two resistors in parallel with resistances $$$a$$$ and $$$b$$$ is $$$(a * b) / (a + b)$$$.

To calculate the equivalent resistance of three parallel resistors, first calculate the equivalent resistance of the first two using the formula described above. Then, use the formula again to calculate the equivalent resistance of the third resistor and the value you just calculated, the equivalent resistance of the first two resistors. Calculating the equivalent resistance of more than three resistors works in a similar way.

Formally, the equivalent resistance of $$$n$$$ resistors can be calculated by plugging in the equivalent resistance of the first $$$n - 1$$$ resistors, and the resistance of the $$$n$$$th resistor, into the above formula.

Input

The first line of input contains a positive integer $$$n$$$ greater than one, indicating the number of resistors in the circuit. Assume that all of the resistors are in parallel with each other. The next line contains $$$n$$$ space-separated positive integers, each representing the resistance of a resistor in the circuit.

Output

Output a single positive decimal number: the equivalent resistance of the circuit. You don't need to (and you shouldn't) round your answer.

ExamplesInput
9
37 23 56 85 41 99 33 22 11
Output
3.319115819885067
Input
2
11 19
Output
6.966666666666667

加入题单

算法标签: