import sys input = sys.stdin.readline N = int(input()) # A = [100003, # 100019, # 100043, # 100049, # 100057] # C = set() # for a in A: # for b in A: # C.add(a*b) # B = sorted(list(C)) # print(B) B = [1, 10000600009, 10002200057, 10003800361, 10004600129, 10005200147, 10006000171, 10006200817, 10006800931, 10007601083, 10008601849, 10009202107, 10009802401, 10010002451, 10010602793, 10011403249] print(B[N-1])