# 285714 N = int(input()) N -= 1 N %= 6 print("285714"[N])