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.
start_number = int(input())  # Get the initial number from the user




while True:

    start_number += 1  # Increment the number



    is_unique = True  # Flag to track if all digits are unique

    for digit in str(start_number):

        if str(start_number).count(digit) > 1:  # If a digit appears more than once
            is_unique = False  # Set the flag to False
        
    if is_unique:  # If all digits are unique in the number
        print(start_number)  # Print the number
        break  # Exit the loop
