
    Given a network of professionals where each professional has a career compatibility score, find the most valuable sequence of career connections that can be formed. The sequence must start from the beginning of the network up to a current professional (at position i), where each subsequent connection must have a higher compatibility score than the previous one. The sequence must also include a specific future professional (at position k, where k > i) to ensure long-term network value. Calculate the maximum total compatibility score achievable through such a sequence of connections, considering both immediate and future networking opportunities.
    

    
def max_sum_increasing_subseq(a, n, index, k):
    """
    Given a network of professionals where each professional has a career compatibility score, find the most valuable sequence of career connections that can be formed. The sequence must start from the beginning of the network up to a current professional (at position i), where each subsequent connection must have a higher compatibility score than the previous one. The sequence must also include a specific future professional (at position k, where k > i) to ensure long-term network value. Calculate the maximum total compatibility score achievable through such a sequence of connections, considering both immediate and future networking opportunities.
    

    """
def max_sum_increasing_subseq(a, n, index, k):
    """
    Given a network of professionals where each professional has a career compatibility score, find the most valuable sequence of career connections that can be formed. The sequence must start from the beginning of the network up to a current professional (at position i), where each subsequent connection must have a higher compatibility score than the previous one. The sequence must also include a specific future professional (at position k, where k > i) to ensure long-term network value. Calculate the maximum total compatibility score achievable through such a sequence of connections, considering both immediate and future networking opportunities.
    

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