PASCAL 2024 Problem 23

A lock code is made up of four digits that satisfy the following rules:

  • At least one digit is a 4 , but neither the second digit nor the fourth digit is a 4 .
  • Exactly one digit is a 2 , but the first digit is not 2 .
  • Exactly one digit is a 7 .
  • The code includes a 1 , or the code includes a 6 , or the code includes two 4 \mathrm{~s}.

How many codes are possible?