/**
 * Given two lists lst1 and lst2, the function appends elements from lst2 to lst1 and multiplies each element in lst1 by its index.
 *
 * @param lst1 The first list.
 * @param lst2 The second list.
 * @return A list containing the elements from lst1 after appending elements from lst2, multiplied by their respective indices.
 *
 * Example:
 * Input:
 * lst1 = [2, 5, 7]
 * lst2 = [1, 3, 4]
 *
 * Output:
 * [2, 5, 7, 0, 6, 8]
 */
fun appendElementsMultiplyList(lst1: MutableList<Int>, lst2: List<Int>): List<Int> {

    for ((index, element) in lst2.withIndex()) {
        lst1.add(element)
    }
    return lst1.mapIndexed { index, num -> num * index }
}
/**
 * Given two lists lst1 and lst2, the function appends elements from lst2 to lst1 and multiplies each element in lst1 by its index.
 *
 * @param lst1 The first list.
 * @param lst2 The second list.
 * @return A list containing the elements from lst1 after appending elements from lst2, multiplied by their respective indices.
 *
 * Example:
 * Input:
 * lst1 = [2, 5, 7]
 * lst2 = [1, 3, 4]
 *
 * Output:
 * [2, 5, 7, 0, 6, 8]
 */
fun appendElementsMultiplyList(lst1: MutableList<Int>, lst2: List<Int>): List<Int> {
/**
 * Given two lists lst1 and lst2, the function appends elements from lst2 to lst1 and multiplies each element in lst1 by its index.
 *
 * @param lst1 The first list.
 * @param lst2 The second list.
 * @return A list containing the elements from lst1 after appending elements from lst2, multiplied by their respective indices.
 *
 * Example:
 * Input:
 * lst1 = [2, 5, 7]
 * lst2 = [1, 3, 4]
 *
 * Output:
 * [2, 5, 7, 0, 6, 8]
 */
fun appendElementsMultiplyList(lst1: MutableList<Int>, lst2: List<Int>): List<Int> {

    for ((index, element) in lst2.withIndex()) {
        lst1.add(element)
    }
    return lst1.mapIndexed { index, num -> num * index }
}