Problem G
Otpor
Mirko has been a very good boy, so he got exactly what he
wanted for his birthday, a “Young physicist” kit! In the kit,
there are
As we all know, resistors can be connected in two different ways, in series and parallel. Also, we know that the complete circuit of resistors can be replaced with one resistor of the resistance equal to the equivalent resistance of the circuit. When the circuit is series, it is written as (R1-R2-R3-…-RK) and the following formula holds:
When the circuit is parallel, it is written as (R1|R2|R3|…|RK) and the following formula holds:
Mirko was excited to bring his new toy to school, where he showed it to all his friends. Unfortunately for him, the teacher also noticed the toy. She quickly connected a circuit and is now asking Mirko to tell her the equivalent resistance of the circuit. Help Mirko and answer the teacher’s question!
Input
The first line of input contains the integer
Output
The first and only line of output must contain the number
from the task. An absolute error up to
Sample Input 1 | Sample Output 1 |
---|---|
3 2 3 6 (R1-R2-R3) |
11.00000 |
Sample Input 2 | Sample Output 2 |
---|---|
3 2 3 6 (R1|R2|R3) |
1.00000 |
Sample Input 3 | Sample Output 3 |
---|---|
5 5 5 5 5 5 ((R1-(R2|R3)-(R4|R5))|(R1-(R2|R3)-(R4|R5))) |
5.00000 |