The product of all digits of positive integer M is 105 How many such Ms are there with distinct digits?

105=3*5*7

total : 3!=3*2*1=6

M can include a 1 as well.

The number of Ms that include a 1 is equal to 4! = 24, so the final answer is 6+24=30