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