txt = '285714' print(txt[(int(input().strip()) - 1) % len(txt)])