In Patrick’s guild, there are ten distinct members, and each member can be one of five classes. In how many ways can the members choose their classes such that the guild has at most two classes that are not represented?
There are 542,380 ways.