n=int(input()) q,r=divmod(n-1,36) for a in range(1,10): for b in range(a+1,10): if r==0: print(str(a)+str(b)*(q+1)) exit() r-=1