k = input()

i = 1
s = 0
t = 0
r = 0
counter = 0
while True :
    r = i + 1
    r = str(r)
    i = str(i)
    for j in i :
        s += int(j)
    for j in r :
        t += int(j)
    
    i = int(i)

    if i*t <= (i+1)*s :
        counter += 1
        if int(k) == counter :
            print(i,end="")
            break
        print(i)
        
    i += 1
    s = 0
    t = 0
    r = 0