
    Design a function for a social event recommendation system that finds the most engaging sequence of events leading up to a specific date, including a mandatory featured event scheduled for later. The sequence must show increasing user engagement scores to ensure progressively higher user interest. The system should analyze engagement patterns from the beginning of the timeline up to the current date and must include a specific future featured event in its recommendations. The goal is to maximize the total engagement score of the selected event sequence while maintaining the increasing engagement trend. The recommendation sequence must respect the chronological order of events and include the designated featured event.
    

    
def max_sum_increasing_subseq(a, n, index, k):
    """
    Design a function for a social event recommendation system that finds the most engaging sequence of events leading up to a specific date, including a mandatory featured event scheduled for later. The sequence must show increasing user engagement scores to ensure progressively higher user interest. The system should analyze engagement patterns from the beginning of the timeline up to the current date and must include a specific future featured event in its recommendations. The goal is to maximize the total engagement score of the selected event sequence while maintaining the increasing engagement trend. The recommendation sequence must respect the chronological order of events and include the designated featured event.
    

    """
def max_sum_increasing_subseq(a, n, index, k):
    """
    Design a function for a social event recommendation system that finds the most engaging sequence of events leading up to a specific date, including a mandatory featured event scheduled for later. The sequence must show increasing user engagement scores to ensure progressively higher user interest. The system should analyze engagement patterns from the beginning of the timeline up to the current date and must include a specific future featured event in its recommendations. The goal is to maximize the total engagement score of the selected event sequence while maintaining the increasing engagement trend. The recommendation sequence must respect the chronological order of events and include the designated featured event.
    

    """
    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]