#include using namespace std; int main(void) { int n; cin >> n; string s = "285714"; --n; n = n % 6; cout << s[n] << endl; return 0; }