i = input() A = "285714" i = (i-1) % 6 print(A[i])