let N = Int(readLine()!)! print(Array("4285714")[N % 6])