All positive integers from 1 to n are written consecutively from left to right: 123456789101112134...n.
How many ways are there to cross out all the digits of the obtained number, except four, so that the remaining digits form the number 2024 without rearrangement?
For example, for n=20 from the number 1234567891011121314151617181920, you can obtain 2024 only in one way:
1 2 34567891 0 111 2 131 4 151617181920
One positive integer n (n≤105).
Print the number of possible ways to obtain the number 2024.