/**
 * Given a rocket and payload, calculate the total mass of the ship.
 *
 * @param rocket A list containing the mass of the rocket's components.
 * @param payload A list containing the mass of the payload's components.
 * @return The total mass of the ship, including both rocket and payload.
 *
 * Example:
 * calculateShipMass(listOf(1000, 5000), listOf(200, 300)) returns 6200.0
 */
fun calculateShipMass(rocket: List<Int>, payload: List<Int>): Double {

    val rocketMass = if (rocket.all { it is Int }) rocket.sum() else 0
    val payloadMass = if (payload.all { it is Int }) payload.sum() else 0

    return (rocketMass + payloadMass).toDouble()
}
/**
 * Given a rocket and payload, calculate the total mass of the ship.
 *
 * @param rocket A list containing the mass of the rocket's components.
 * @param payload A list containing the mass of the payload's components.
 * @return The total mass of the ship, including both rocket and payload.
 *
 * Example:
 * calculateShipMass(listOf(1000, 5000), listOf(200, 300)) returns 6200.0
 */
fun calculateShipMass(rocket: List<Int>, payload: List<Int>): Double {
/**
 * Given a rocket and payload, calculate the total mass of the ship.
 *
 * @param rocket A list containing the mass of the rocket's components.
 * @param payload A list containing the mass of the payload's components.
 * @return The total mass of the ship, including both rocket and payload.
 *
 * Example:
 * calculateShipMass(listOf(1000, 5000), listOf(200, 300)) returns 6200.0
 */
fun calculateShipMass(rocket: List<Int>, payload: List<Int>): Double {

    val rocketMass = if (rocket.all { it is Int }) rocket.sum() else 0
    val payloadMass = if (payload.all { it is Int }) payload.sum() else 0

    return (rocketMass + payloadMass).toDouble()
}