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