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