DDR3
At a factory producing DDR3 memory modules, the daily production is automatically recorded. The computer logs the numbers of the produced modules sequentially, starting from 1 and continuing consecutively up to the last module produced that day. However, due to a programming error, a malfunction occurred. Instead of outputting a sequence of consecutive numbers, the program produced a sequence of length K digits without spaces. Additionally, if there were multiple identical digits in a row, only one was printed. The programmer needs your help to quickly determine how many modules were produced in a day. Note that there were no other errors in the program besides the omission of consecutive identical digits and spaces.
Input
The program reads a single number K (1 ≤ K ≤ 10^18).
Output
The program outputs a single number, which is the total number of modules produced in a day.
Explanation of the example: In a correctly functioning system, the sequence should be:
1 2 3 4 5 6 7 8 9 10 11 12
However, the program output was:
1234567891012, which is 13 digits long without spaces.