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