def sum_range(num: int) -> int:
    """Returns the sum of range(num + 1)."""
    assert type(num) == int, "Non-negative integers only."
    if num == 0:
        return 0
    return num + sum_range(num - 1)