It seems like the year of 2013 came only yesterday. Do you know a curious fact? The year of 2013 is the first year after the old 1987 with only distinct digits.

Now you are suggested to solve the following problem: given a year number, find the minimum year number which is strictly larger than the given one and has only distinct digits.
The single line contains integer *y* (1000 ≤ *y* ≤ 9000) — the year number.
def is_beautiful(year):
    a = year % 10
    b = (year // 10) % 10
    if b == a:
        return False
    c = (year // 100) % 10
    if c == a or c == b:
        return False
    d = (year // 1000) % 10
    if d == a or d == b or d == c:
        return False
    return True

def main():
    number = int(input())
    while not is_beautiful(number + 1):
        number += 1
    print(number)

if __name__ == "__main__":
    main()
