
    Design a function for the fraud detection system that calculates the total number of shared transaction frequency patterns between a card's total transaction count and its authorized merchant transactions, where a shared pattern exists if both counts are perfectly divisible by the same number. This calculation helps identify if the current transaction behavior aligns with established legitimate patterns, serving as one of the indicators in fraud detection.
    

    
def sum(a, b):
    """
    Design a function for the fraud detection system that calculates the total number of shared transaction frequency patterns between a card's total transaction count and its authorized merchant transactions, where a shared pattern exists if both counts are perfectly divisible by the same number. This calculation helps identify if the current transaction behavior aligns with established legitimate patterns, serving as one of the indicators in fraud detection.
    

    """
def sum(a, b):
    """
    Design a function for the fraud detection system that calculates the total number of shared transaction frequency patterns between a card's total transaction count and its authorized merchant transactions, where a shared pattern exists if both counts are perfectly divisible by the same number. This calculation helps identify if the current transaction behavior aligns with established legitimate patterns, serving as one of the indicators in fraud detection.
    

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