```python
def sum_gp(a, n, r):
    """
    Calculates the sum of a geometric progression series.

    Args:
        a: The first term of the series.
        n: The number of terms in the series.
        r: The common ratio of the series.

    Returns:
        The sum of the geometric progression series.
    """
    if r == 1:
        return n * a
    else:
        return a * (1 - r**n) / (1 - r)

```