N = int(input()) a = (N-1)//36 b = (N-1)%36+1 cnt = 0 for i in range(1,9): for j in range(i+1,10): cnt+=1 if cnt==b: print(str(i*10+j)+str(j)*a)