# 2桁以上なら最初の桁と残りの桁が、12,13,14,,,19,23,24,25,,,,89 two_digit = [] for a in range(1, 10): for b in range(a+1, 10): two_digit.append((a, b)) L = len(two_digit) #print(two_digit) #print(L) N = int(input()) b_num = (N-1)//L+1 idx = (N-1)%L ans = str(two_digit[idx][0])+str(two_digit[idx][1])*b_num print(ans)