eolymp
bolt
Try our new interface for solving problems
Problems

Get 2024

Get 2024

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: \sout{1}\quad$2$\quad\sout{34567891}\quad0\quad\sout{111}\quad2\quad\sout{131}\quad4\quad\sout{151617181920} \InputFile One positive integer $n~(n \le 10^5)$. \OutputFile Print the number of possible ways to obtain the number $2024$.
Time limit 1 second
Memory limit 256 MiB
Input example #1
10
Output example #1
0
Input example #2
20
Output example #2
1
Input example #3
27
Output example #3
23