Maximum#474

Maximum

1 second
64 megabytes
Easy

Recently, first-grader Vasya learned how to add numbers. He liked this process very much and started adding everything in sight. When all nearby numbers were summed up, Vasya turned to his older brother Petya for new numbers. After several such requests, tired of acting as a random number generator, Petya came up with a task that could keep Vasya busy for a long time.

Petya suggested that Vasya find the sums of the digits of consecutive numbers — , , , , , , , , , , , , , , , , , , , , — and so on, until he got bored. Vasya was excited by the idea and started working. Yesterday, Vasya found the sum of the digits for each number from to . Looking at his younger brother's results, Petya noticed that the sums of the digits of consecutive numbers are not random; they often form a sequence, but he could not fully understand the pattern.

To find a pattern, Petya decided to study extreme cases, such as which number gives the largest sum of digits. The data for numbers up to was not enough for a final conclusion, and Petya thought of speeding up the calculations by using a computer instead of his brother. As he was not strong in programming himself, he turned to you for a solution to this problem.

Input

The first line of the input contains the integer (1 \leq N \leq 2\ 147\ 483\ 647).

Output

Output the number from to inclusive with the maximum sum of digits. If there are several numbers with the maximum sum of digits, output the greatest of them.

Examples

Example 1

Loading
Loading