N = int(input()) s = N //36 #print(s) t = N%36 #print(t) count = 0 for i in range(1,9): if count + 9-i < t: count += 9-i else: a = i b = t-count+i break print(str(a)+str(b)*(s+1))