6516: ABC234 —— E - Arithmetic Number
[Creator : ]
Description
Let us call a positive integer nn that satisfies the following condition an arithmetic number.
Find the smallest arithmetic number not less than $X$.
-
Let $d_i$ be the $i$-th digit of $n$ from the top (when $n$ is written in base $10$ without unnecessary leading zeros.) Then, $(d_2-d_1)=(d_3-d_2)=\dots=(d_k-d_{k-1})$ holds, where $k$ is the number of digits in $n$.
- This condition can be rephrased into the sequence (d_1,d_2,\dots,d_k)(d1,d2,…,dk) being arithmetic.
- If $n$ is a $1$-digit integer, it is assumed to be an arithmetic number.
Find the smallest arithmetic number not less than $X$.
Input
Input is given from Standard Input in the following format:
$X$
$X$
Output
Print the answer as an integer.
Constraints
$X$ is an integer between $1$ and $10^{17}$ (inclusive).
Sample 1 Input
152
Sample 1 Output
159
The smallest arithmetic number not less than $152$ is $159$.
Sample 2 Input
88
Sample 2 Output
88
$X$ itself may be an arithmetic number.
Sample 3 Input
8989898989
Sample 3 Output
9876543210