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.
in_y = int(input())
i_lst = []
dgt = 0
dst_att = False

if (in_y < 1000) or (in_y > 9000):
    print("Error_1")

fxd_v = in_y
while dst_att == False:
    fxd_v += 1
    in_y = fxd_v
    dst_att = True
    i_lst.clear()
    while in_y > 1:
        dgt = int(in_y % 10)
        i_lst.append(dgt)
        in_y /= 10

    for loop_1_ctr in range(0,len(i_lst)):
        for loop_2_ctr in range((loop_1_ctr + 1),len(i_lst)):
            if i_lst.__getitem__(loop_1_ctr) == i_lst.__getitem__(loop_2_ctr):
                dst_att = False
    
print(fxd_v)

