list=[100003, 100019, 100043, 100049, 100057, 100069, 100103, 100129, 100151, 100153, 100169] newlist=[] for i in list: for j in list: newlist.append(i*j) newlist.append(1) newlist.sort() print(newlist[int(input())-1])