#include #include #include #include using namespace std; int main() { const string A = "285714"; int N; cin >> N; if (N % 6 != 0) { cout << A.at(N % 6 - 1) << endl; } else if (N % 6 == 0) { cout << 4 << endl; } }