2013 is the first year since 1987 in which all digits are distinct. The years 2014, 2015, 2016, 2017, 2018, and 2019 also have all distinct digits. The year 2012, however, does not, because the digit 2 appears twice.
Given a year $Y$, find the earliest year greater than $Y$ in which every digit is distinct.
The first line contains a single integer $Y$, the starting year. ($0 \le Y \le 10000$)
Print the earliest year $D$ greater than $Y$ in which every digit is distinct.