Completed the new math section, accounting for the conditional constraints