P=[100003,100019,100043,100049,100057,100069] S={1} for i in P: for j in P: S.add(i*j) S=sorted(S) print(S[int(input())-1])