n = int(input()) n -= 1 L = [str(i)+str(j) for i in range(1,10) for j in range(i+1,10)] q,r = divmod(n,36) ans = L[r]+L[r][1]*q print(ans)