N = int(input()) print(str((2 * pow(10, N)) // 7)[-1])