N = int(input()) N-=1 c = N//36 m = N%36 for a in range(1, 10): for b in range(a+1, 10): if m==0: ans = str(a)+str(b)*(c+1) print(ans) exit() m-=1