Resistors in Series or Parallel
Series resistors add: . Parallel resistors add as reciprocals: . Print the total resistance with 2 decimals.
Input
Line 1: series or parallel. Line 2: followed by resistances in ohms.
Output
The total resistance.
Constraints
, each between 1 and Ω.
Sample 1
Input
series 3 100 220 330
Output
650.00
Sample 2
Input
parallel 2 1000 1000
Output
500.00