The Length of the Sequence
Time limit1sMemory limit1024 MB
Given a total digit count S, find the longest run of consecutive non-negative integers whose concatenated decimal form has exactly S digits, or report -1.
Problem
Consider the non-negative integers from to . Write them in a row in decimal notation, getting a string . For example, if and , then .
Find a segment of consecutive non-negative integers () such that the length of the string is exactly and the number of integers in the segment is as large as possible.
Input
The only line contains one integer ().
Output
Print the length of the optimal segment in the first line. If there is no solution, print .
If a solution exists, print two integers and on the second line. If there are multiple optimal solutions, print any of them.