
    Given a delivery route segment with fuel consumption values at n checkpoints that is repeated k times throughout the day's delivery network, determine the consecutive sequence of checkpoints that results in the highest total fuel consumption to identify the most inefficient stretch of the repeated route pattern. The sequence can span across repeated segments of the route, and the goal is to optimize fuel efficiency by identifying and addressing the most resource-intensive portion of the delivery cycle.
    

    
def max_sub_array_sum_repeated(a, n, k):
    """
    Given a delivery route segment with fuel consumption values at n checkpoints that is repeated k times throughout the day's delivery network, determine the consecutive sequence of checkpoints that results in the highest total fuel consumption to identify the most inefficient stretch of the repeated route pattern. The sequence can span across repeated segments of the route, and the goal is to optimize fuel efficiency by identifying and addressing the most resource-intensive portion of the delivery cycle.
    

    """
def max_sub_array_sum_repeated(a, n, k):
    """
    Given a delivery route segment with fuel consumption values at n checkpoints that is repeated k times throughout the day's delivery network, determine the consecutive sequence of checkpoints that results in the highest total fuel consumption to identify the most inefficient stretch of the repeated route pattern. The sequence can span across repeated segments of the route, and the goal is to optimize fuel efficiency by identifying and addressing the most resource-intensive portion of the delivery cycle.
    

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