N=int(input())-1 AB=[(a,b) for a in range(1,10) for b in range(a+1,10)] c,r=divmod(N,36) a,b=AB[r] ans=str(a)+str(b)*(c+1) print(ans)