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