n = int(input()) l = [] for i in range(10,100): if i % 10 > i//10: l.append(i) m = len(l) mul = (n-1)//m ans = str(l[(n-1)%m]) ans += ans[-1] *mul print(ans)