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