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