def invoice_total(subtotal_cents: int, member: bool = False) -> int: if subtotal_cents < 0: raise ValueError("subtotal must be non-negative") discounted = subtotal_cents - (subtotal_cents // 10 if member else 0) shipping = 0 if subtotal_cents > 10000 else 500 return discounted + shipping