n = int(input()) ans = [1] li1 = [10**5+1+i for i in range(10)] li2 = [10**5+1+i for i in range(10)] for i in range(len(li1)): for j in range(len(li2)): if i == j: continue ans.append(li1[i]*li2[j]) ans = set(ans) ans = list(ans) ans.sort() print(ans[n-1])