Resistors
Maximum working time on one test: | 3 seconds |
Amateur radio operator Petya decided to assemble a detector receiver. To do this, he needed a capacitor with a capacity of C UF. Petya has at his disposal a set of n capacitors whose capacitances are equal to c 1, c 2, ..., c n, respectively. Petya remembers how the capacity of the parallel connection of two capacitors is calculated (C new = C1 + C 2) and the serial connection of two capacitors (C new = (C 1*C 2)/(C1+C2)). Petya wants to solder some series-parallel circuit from an existing set of capacitors, such that its capacitance is closest to the desired one (that is, the absolute value of the difference in values is minimal). Of course, Petya is not obliged to use all the capacitors to make the circuit.
Recall the definition of a series-parallel circuit. A circuit made up of a single capacitor is a series-parallel circuit. Any circuit obtained by a serial connection of two series-parallel circuits is series–parallel, as well as any circuit obtained by a parallel connection of two series-parallel circuits is series-parallel.
The first line of the input data contains the numbers n and C. The second line specifies the sequence of capacitances of available capacitors with 1, with 2, ..., with n. The values of all capacities are real numbers. For all input data sets n < 7.
Output the capacitance of the series-parallel circuit that is minimally different from C from the available capacitors. Output the result with six decimal places.
4 31.21 5 20 10 17
31.296296296296296300