#include "bits/stdc++.h" typedef long long ll; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); // -------------------------------------- int N; cin >> N; string junkan = "285714"; cout << junkan[N%6 - 1] << "\n"; }