Resistance
Easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
A resistor with resistance (R_1) is connected in series with a resistor of resistance (R_2). Following this, another resistor with resistance (R_1) is connected in parallel to the existing circuit. This pattern continues with another (R_2) resistor being added, and so forth. In total, the circuit will consist of (N) resistors (refer to the figure).
Your task is to determine the total resistance of this circuit.
Input
The input consists of three integers: (N), (R_1), and (R_2).
Constraints are as follows: (1 N 2,147,483,647) and (1 R_1, R_2 5000).
Output
The output should be the total resistance of the circuit, calculated to a precision of (10^-10).
Examples
Input #1
Answer #1
Submissions 462
Acceptance rate 17%