a = int(input()) b = str(2 / 7) print(b[a+1])