
    Given two student essays with word counts 'a' and 'b' respectively, write a function to calculate the sum of all common text length patterns (common divisors of word counts) that could be used to segment both essays into equal-length sections for comparison. This analysis will help identify potential structural similarities between the essays based on how their total lengths can be broken down into matching segment sizes.
    

    
def sum(a, b):
    """
    Given two student essays with word counts 'a' and 'b' respectively, write a function to calculate the sum of all common text length patterns (common divisors of word counts) that could be used to segment both essays into equal-length sections for comparison. This analysis will help identify potential structural similarities between the essays based on how their total lengths can be broken down into matching segment sizes.
    

    """
def sum(a, b):
    """
    Given two student essays with word counts 'a' and 'b' respectively, write a function to calculate the sum of all common text length patterns (common divisors of word counts) that could be used to segment both essays into equal-length sections for comparison. This analysis will help identify potential structural similarities between the essays based on how their total lengths can be broken down into matching segment sizes.
    

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