```python
def ap_sum(a, n, d):
    """
    Calculates the sum of an arithmetic progression.

    Args:
        a: The first term of the sequence.
        n: The number of terms.
        d: The common difference.

    Returns:
        The sum of the arithmetic progression.
    """
    # The formula for the sum of an arithmetic progression is:
    # S_n = n/2 * (2a + (n-1)d)
    sum_of_progression = (n / 2) * (2 * a + (n - 1) * d)
    return sum_of_progression

```