import sys input = sys.stdin.readline N = int(input()) # A = [100003, # 100019, # 100043, # 100049, # 100057, 100069] # 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, 10007200207, 10007601083, 10008601849, 10008801311, 10009202107, 10009802401, 10010002451, 10010602793, 10011202967, 10011403249, 10011803381, 10012603933, 10013804761] print(B[N-1])