Question
Unique Climb

Lila is given an integer M. A distinct number is one where no digit appears more than once, like 567, 128, or 3, but not 717, 5500, or 22. Find the smallest distinct number greater than M.

Input
The first line of the input contains an integer M.

Constraints
1 ≤ N ≤ 105
Output
Print the smallest special integer greater than M.
Example
Sample Input
9
Sample Output
10

Sample Input
1999
Sample Output
2013

Online