/**
 * This function takes a list of integers and appends new elements to it. After appending, it multiplies each element of the list
 * by its index and returns the final list.
 *
 * @param numbersList List of integers
 * @param newElements List of integers to append to the numbersList
 * @return List of integers after appending new elements and multiplying each element by its index
 */
fun appendAndMultiply(numbersList: MutableList<Int>, newElements: List<Int>): List<Int> {

    // Appending new elements to the numbersList
    numbersList.addAll(newElements)

    // Multiplying each element by its index
    val multipliedList = numbersList.mapIndexed { index, num -> num * index }

    return multipliedList
}
/**
 * This function takes a list of integers and appends new elements to it. After appending, it multiplies each element of the list
 * by its index and returns the final list.
 *
 * @param numbersList List of integers
 * @param newElements List of integers to append to the numbersList
 * @return List of integers after appending new elements and multiplying each element by its index
 */
fun appendAndMultiply(numbersList: MutableList<Int>, newElements: List<Int>): List<Int> {
/**
 * This function takes a list of integers and appends new elements to it. After appending, it multiplies each element of the list
 * by its index and returns the final list.
 *
 * @param numbersList List of integers
 * @param newElements List of integers to append to the numbersList
 * @return List of integers after appending new elements and multiplying each element by its index
 */
fun appendAndMultiply(numbersList: MutableList<Int>, newElements: List<Int>): List<Int> {

    // Appending new elements to the numbersList
    numbersList.addAll(newElements)

    // Multiplying each element by its index
    val multipliedList = numbersList.mapIndexed { index, num -> num * index }

    return multipliedList
}