
    Develop a fraud detection function that calculates the sum of all common spending threshold values that perfectly divide both the customer's current daily total transactions and their historical daily average spending, as these common factors could indicate normal spending patterns. The function should take two inputs: the current day's total transaction amount and the historical daily average spending amount.
    

    
def sum(a, b):
    """
    Develop a fraud detection function that calculates the sum of all common spending threshold values that perfectly divide both the customer's current daily total transactions and their historical daily average spending, as these common factors could indicate normal spending patterns. The function should take two inputs: the current day's total transaction amount and the historical daily average spending amount.
    

    """
def sum(a, b):
    """
    Develop a fraud detection function that calculates the sum of all common spending threshold values that perfectly divide both the customer's current daily total transactions and their historical daily average spending, as these common factors could indicate normal spending patterns. The function should take two inputs: the current day's total transaction amount and the historical daily average spending amount.
    

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