
    At a busy urban intersection, you need to calculate the total number of vehicles that will pass through during the queue clearance process. Starting with an initial queue of n vehicles, each signal cycle allows approximately 2 vehicles to clear the intersection. The clearance pattern follows a sequence where in each cycle, the remaining queue length decreases by 2 vehicles (n, n-2, n-4, etc.) until no vehicles remain. Write a function that calculates the sum of vehicles remaining in each state of the queue clearance process, which will help traffic engineers optimize signal timing patterns. The calculation should stop when the remaining queue length becomes zero or negative, and the final sum will represent the cumulative load on the intersection during the entire clearance period.
    

    
def sum_series(n):
    """
    At a busy urban intersection, you need to calculate the total number of vehicles that will pass through during the queue clearance process. Starting with an initial queue of n vehicles, each signal cycle allows approximately 2 vehicles to clear the intersection. The clearance pattern follows a sequence where in each cycle, the remaining queue length decreases by 2 vehicles (n, n-2, n-4, etc.) until no vehicles remain. Write a function that calculates the sum of vehicles remaining in each state of the queue clearance process, which will help traffic engineers optimize signal timing patterns. The calculation should stop when the remaining queue length becomes zero or negative, and the final sum will represent the cumulative load on the intersection during the entire clearance period.
    

    """
def sum_series(n):
    """
    At a busy urban intersection, you need to calculate the total number of vehicles that will pass through during the queue clearance process. Starting with an initial queue of n vehicles, each signal cycle allows approximately 2 vehicles to clear the intersection. The clearance pattern follows a sequence where in each cycle, the remaining queue length decreases by 2 vehicles (n, n-2, n-4, etc.) until no vehicles remain. Write a function that calculates the sum of vehicles remaining in each state of the queue clearance process, which will help traffic engineers optimize signal timing patterns. The calculation should stop when the remaining queue length becomes zero or negative, and the final sum will represent the cumulative load on the intersection during the entire clearance period.
    

    """
    if n < 1:
        return 0
    else:
        return n + sum_series(n - 2)