```python
def tier_cost(units: int, allowance: int, first_rate: int, later_rate: int) -> int:
    """
    Calculate the cost of a number of units based on tiered pricing.
    
    Args:
    units (int): The number of units to charge.
    allowance (int): The allowance for the first rate.
    first_rate (int): The rate for units within the allowance.
    later_rate (int): The rate for units beyond the allowance.
    
    Returns:
    int: The total cost in whole pence.
    
    Raises:
    ValueError: If units are below zero.
    """
    if units < 0:
        raise ValueError("Units cannot be below zero.")
    
    if allowance < 0:
        allowance = 0
    
    if units <= allowance:
        return units * first_rate
    else:
        return allowance * first_rate + (units - allowance) * later_rate
```