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

    Args:
      a: The first term of the series.
      n: The number of terms in the series.
      d: The common difference between terms.

    Returns:
      The sum of the arithmetic progression.
    """
    if n < 0:
        return 0
    return (n / 2) * (2 * a + (n - 1) * d)

```