7040.Writing Numbers

Time Limit: 1s Memory Limit: 512MB

You would like to write a list of positive integers $1,2,3,\ldots$ using your computer. However, you can press each key $0$ – $9$ at most $n$ times during the process.

What is the last number you can write?

Input Format(From the terminal/stdin)

The only input line contains the value of $n$ .

  • $1 \le n \le 10^{18}$

Output Format(To the terminal/stdout)

Print the last number you can write.

Sample Input

Copy
5
 \n

Sample Output

Copy
12
  \n

Hints

For sample 1, You can write the numbers $1,2,\ldots,12$ . This requires that you press key $1$ five times, so you cannot write the number $13$ .

Source: CSES, Additional Problems I, 1086

Submit

请先 登录

© 2025 FAQs