407129: GYM102697 100 Ohm Sweet Ohm
Description
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.
InputThe 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.
OutputOutput a single positive decimal number: the equivalent resistance of the circuit. You don't need to (and you shouldn't) round your answer.
ExamplesInput9 37 23 56 85 41 99 33 22 11Output
3.319115819885067Input
2 11 19Output
6.966666666666667