
    Given a list of user engagement scores for different events and knowing these events repeat for k seasons, find the consecutive sequence of events that would generate the highest combined engagement score when a user attends them in succession. The engagement scores for each event remain the same across seasons, and the sequence can span across season boundaries.
    

    
def max_sub_array_sum_repeated(a, n, k):
    """
    Given a list of user engagement scores for different events and knowing these events repeat for k seasons, find the consecutive sequence of events that would generate the highest combined engagement score when a user attends them in succession. The engagement scores for each event remain the same across seasons, and the sequence can span across season boundaries.
    

    """
def max_sub_array_sum_repeated(a, n, k):
    """
    Given a list of user engagement scores for different events and knowing these events repeat for k seasons, find the consecutive sequence of events that would generate the highest combined engagement score when a user attends them in succession. The engagement scores for each event remain the same across seasons, and the sequence can span across season boundaries.
    

    """
    max_so_far = -2147483648
    max_ending_here = 0
    for i in range(n * k):
        max_ending_here = max_ending_here + a[i % n]
        if max_so_far < max_ending_here:
            max_so_far = max_ending_here
        if max_ending_here < 0:
            max_ending_here = 0
    return max_so_far