#0002FD

Veci

Your program will be given an integer X. Find the smallest number larger than X consisting of the same digits as X.


InputThe first line of input contains the integer X (1 ≤ X ≤ 999 999). The first digit in X will not be a zero.

OutputOutput the result on a single line. If there is no such number, output 0.

Input
156
Output
165

Input
330
Output
0

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.