
    Design a traffic signal synchronization function that calculates the total number of viable signal timing patterns common to both intersecting roads, where each pattern must evenly divide into both the first road's vehicle count (a) and the second road's vehicle count (b) during a given time interval. This calculation will help determine optimal traffic light cycles that can efficiently handle the flow of vehicles through both roads simultaneously.
    

    
def sum(a, b):
    """
    Design a traffic signal synchronization function that calculates the total number of viable signal timing patterns common to both intersecting roads, where each pattern must evenly divide into both the first road's vehicle count (a) and the second road's vehicle count (b) during a given time interval. This calculation will help determine optimal traffic light cycles that can efficiently handle the flow of vehicles through both roads simultaneously.
    

    """
def sum(a, b):
    """
    Design a traffic signal synchronization function that calculates the total number of viable signal timing patterns common to both intersecting roads, where each pattern must evenly divide into both the first road's vehicle count (a) and the second road's vehicle count (b) during a given time interval. This calculation will help determine optimal traffic light cycles that can efficiently handle the flow of vehicles through both roads simultaneously.
    

    """
    sum = 0
    for i in range(1, min(a, b)):
        if a % i == 0 and b % i == 0:
            sum += i
    return sum