def rare_last_digit(first):
    """Given a leading digit, first, return all possible last digits of a rare number"""

    if first == 2:
        return (2,)
    elif first == 4:
        return (0,)
    elif first == 6:
        return (0,5)
    elif first == 8:
        return (2,3,7,8)
    else:
        raise ValueError(f"Invalid first digit of rare number: {first}")