eolymp
bolt
Try our new interface for solving problems
Problems

Page numbering

Page numbering

For numbering m pages in the book n digits were used. By given n output the corresponding m or 0 if there is no solution. Numbering starts from first page.

Input

The only number n. The book contains no more than 7000 pages.

Output

Print the number of pages in the book.

Time limit 1 second
Memory limit 128 MiB
Input example #1
27
Output example #1
18