
    Design a loan evaluation algorithm that analyzes a customer's income progression to determine their maximum reliable income trend. The algorithm should calculate the highest possible sum of consistently increasing monthly incomes up to a specified evaluation point in their financial history. Additionally, it must incorporate a projected future income amount from a specific later month to assess long-term loan viability. The algorithm should only consider sequences where each subsequent income value is higher than the previous one, ensuring a stable upward financial trajectory. The evaluation must maintain the sequential order of the income records while maximizing the total sum of the selected months.
    

    
def max_sum_increasing_subseq(a, n, index, k):
    """
    Design a loan evaluation algorithm that analyzes a customer's income progression to determine their maximum reliable income trend. The algorithm should calculate the highest possible sum of consistently increasing monthly incomes up to a specified evaluation point in their financial history. Additionally, it must incorporate a projected future income amount from a specific later month to assess long-term loan viability. The algorithm should only consider sequences where each subsequent income value is higher than the previous one, ensuring a stable upward financial trajectory. The evaluation must maintain the sequential order of the income records while maximizing the total sum of the selected months.
    

    """
def max_sum_increasing_subseq(a, n, index, k):
    """
    Design a loan evaluation algorithm that analyzes a customer's income progression to determine their maximum reliable income trend. The algorithm should calculate the highest possible sum of consistently increasing monthly incomes up to a specified evaluation point in their financial history. Additionally, it must incorporate a projected future income amount from a specific later month to assess long-term loan viability. The algorithm should only consider sequences where each subsequent income value is higher than the previous one, ensuring a stable upward financial trajectory. The evaluation must maintain the sequential order of the income records while maximizing the total sum of the selected months.
    

    """
    dp = [[0 for i in range(n)] for i in range(n)]
    for i in range(n):
        if a[i] > a[0]:
            dp[0][i] = a[i] + a[0]
        else:
            dp[0][i] = a[i]
    for i in range(1, n):
        for j in range(n):
            if a[j] > a[i] and j > i:
                if dp[i - 1][i] + a[j] > dp[i - 1][j]:
                    dp[i][j] = dp[i - 1][i] + a[j]
                else:
                    dp[i][j] = dp[i - 1][j]
            else:
                dp[i][j] = dp[i - 1][j]
    return dp[index][k]