l=[-1, 7, 11, 13, 17, 19, 23, 29, 30, 31, 37] print(l[int(input())])