In this puzzle, you have to place enough zeroes to make a number have a certain number of digits. For example you are expected to take the 3-digit number $123$ and are expected to make it 5 digits. So you have to place 2 zeroes in any part(except the beginning) of the number. Like,
$$12003$$ $$10023$$ $$10203$$ $$etc.$$
The thing is, the order of digit can also be changed. So these are also counted as a result. $$21003$$ $$30021$$ $$20103$$ $$etc.$$
The objective is to find the count of different positions(permutations) that this 5 digits number can have. So easy enough, This problem can be solved by the stars-and-bars method. First we find the number of permutations the 3 digit number can have. Then we use the stars and bars methods to find how many positions that the zeroes can be placed. Then multiplicate it. However there is a catch that makes this problem much harder. What if a there is a upper limit number that restricts you from using this easy method. For example if upper limit number is $28192$. The permutation $30021$ is no longer viable so must be taken off from the count. How would you solve this problem mathematically.?
Note1: First given number will not contain any zeroes.
Note2: The upper limit number will always be same digits as the target digit count.