#include using namespace std; int main() { int N; cin >> N; string S = "285714"; cout << S.at(N % 6 - 1) << "\n"; }