/**
 * Calculate the total resistance by multiplying consecutive resistors.
 *
 * @param resistors List of resistance values.
 * @param multiplier Multiplier to apply to the total resistance.
 * @return Total resistance multiplied by the multiplier.
 *
 * Example:
 * calculateTotalResistance(listOf(10, 20, 30, 40), 2) returns 2400.0
 */
fun calculateTotalResistance(resistors: List<Int>, multiplier: Int): Double {

    var totalResistance = 1.0

    // Loop through the resistors
    for (i in resistors.indices) {
        // Calculate the accumulated resistance until the current resistor
        if (i != resistors.size - 1) {
            for (j in 0..i) {
                totalResistance *= resistors[j]
            }
        }

        // Check if the current resistor is a multiple of 10
        // If true, calculate the resistance by multiplying with the multiplier
        if (resistors[i] % 10 == 0) {
            totalResistance *= resistors[i] * multiplier
        }
    }

    return totalResistance
}
/**
 * Calculate the total resistance by multiplying consecutive resistors.
 *
 * @param resistors List of resistance values.
 * @param multiplier Multiplier to apply to the total resistance.
 * @return Total resistance multiplied by the multiplier.
 *
 * Example:
 * calculateTotalResistance(listOf(10, 20, 30, 40), 2) returns 2400.0
 */
fun calculateTotalResistance(resistors: List<Int>, multiplier: Int): Double {
/**
 * Calculate the total resistance by multiplying consecutive resistors.
 *
 * @param resistors List of resistance values.
 * @param multiplier Multiplier to apply to the total resistance.
 * @return Total resistance multiplied by the multiplier.
 *
 * Example:
 * calculateTotalResistance(listOf(10, 20, 30, 40), 2) returns 2400.0
 */
fun calculateTotalResistance(resistors: List<Int>, multiplier: Int): Double {

    var totalResistance = 1.0

    // Loop through the resistors
    for (i in resistors.indices) {
        // Calculate the accumulated resistance until the current resistor
        if (i != resistors.size - 1) {
            for (j in 0..i) {
                totalResistance *= resistors[j]
            }
        }

        // Check if the current resistor is a multiple of 10
        // If true, calculate the resistance by multiplying with the multiplier
        if (resistors[i] % 10 == 0) {
            totalResistance *= resistors[i] * multiplier
        }
    }

    return totalResistance
}