```python
def sum(a, b):
    """
    Finds the sum of common divisors of two given numbers.
    """
    common_divisor_sum = 0
    
    # The largest possible common divisor is the smaller of the two numbers.
    # We iterate from 1 up to this limit.
    limit = min(a, b)
    
    for i in range(1, limit + 1):
        # Check if the current number 'i' divides both 'a' and 'b'
        if a % i == 0 and b % i == 0:
            common_divisor_sum += i
            
    return common_divisor_sum
```