import sys input = sys.stdin.readline A040121 = [7, 11, 13, 17, 19, 23, 29, 47, 59, 61, 73, 89, 97, 101, 103, 109, 113, 127, 131, 137, 139, 149, 157, 167, 179, 181, 193, 197, 211, 223, 229, 233, 251, 257, 263, 269, 281, 293, 313, 331, 337, 349, 353, 367, 373] N = int(input()) print(A040121[N-1])