
    Given a client's historical monthly investment returns, find the optimal combination of growth periods that would yield the maximum portfolio value by multiplying the returns of consistently increasing months. The selected months must maintain an upward trend in returns, representing periods of sustained market growth.
    

    
def max_product(arr):
    """
    Given a client's historical monthly investment returns, find the optimal combination of growth periods that would yield the maximum portfolio value by multiplying the returns of consistently increasing months. The selected months must maintain an upward trend in returns, representing periods of sustained market growth.
    

    """
def max_product(arr):
    """
    Given a client's historical monthly investment returns, find the optimal combination of growth periods that would yield the maximum portfolio value by multiplying the returns of consistently increasing months. The selected months must maintain an upward trend in returns, representing periods of sustained market growth.
    

    """
    n = len(arr)
    mpis = arr[:]
    for i in range(n):
        current_prod = arr[i]
        j = i + 1
        while j < n:
            if arr[j - 1] > arr[j]:
                break
            current_prod *= arr[j]
            if current_prod > mpis[j]:
                mpis[j] = current_prod
            j = j + 1
    return max(mpis)