def solution(n: int = 1000) -> int:
    """
    Returns ∑ r_max for 3 <= a <= n as explained above
    >>> solution(10)
    300
    >>> solution(100)
    330750
    >>> solution(1000)
    333082500
    """
    return sum(2 * a * ((a - 1) // 2) for a in range(3, n + 1))