def Main(): s="285714" n=int(input())-1 print(s[n%6]) Main()