
    Given historical traffic congestion scores for different segments of a delivery route and the number of delivery cycles per day, determine the most challenging continuous stretch of road segments that drivers will encounter when completing multiple delivery rounds. The continuous stretch may span across consecutive delivery cycles, and the traffic pattern repeats for each cycle throughout the day.
    

    
def max_sub_array_sum_repeated(a, n, k):
    """
    Given historical traffic congestion scores for different segments of a delivery route and the number of delivery cycles per day, determine the most challenging continuous stretch of road segments that drivers will encounter when completing multiple delivery rounds. The continuous stretch may span across consecutive delivery cycles, and the traffic pattern repeats for each cycle throughout the day.
    

    """
def max_sub_array_sum_repeated(a, n, k):
    """
    Given historical traffic congestion scores for different segments of a delivery route and the number of delivery cycles per day, determine the most challenging continuous stretch of road segments that drivers will encounter when completing multiple delivery rounds. The continuous stretch may span across consecutive delivery cycles, and the traffic pattern repeats for each cycle throughout the day.
    

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