
    Given two users in a social network with 'a' and 'b' total connections respectively, calculate the potential strength of their friendship by finding the sum of all common social circle sizes that could evenly connect both users. For example, if user A has 12 connections and user B has 18 connections, the common social circle sizes would be factors that divide both 12 and 18 evenly, and summing these common factors would give us their friendship strength score.
    

    
def sum(a, b):
    """
    Given two users in a social network with 'a' and 'b' total connections respectively, calculate the potential strength of their friendship by finding the sum of all common social circle sizes that could evenly connect both users. For example, if user A has 12 connections and user B has 18 connections, the common social circle sizes would be factors that divide both 12 and 18 evenly, and summing these common factors would give us their friendship strength score.
    

    """
def sum(a, b):
    """
    Given two users in a social network with 'a' and 'b' total connections respectively, calculate the potential strength of their friendship by finding the sum of all common social circle sizes that could evenly connect both users. For example, if user A has 12 connections and user B has 18 connections, the common social circle sizes would be factors that divide both 12 and 18 evenly, and summing these common factors would give us their friendship strength score.
    

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