#include using namespace std; int s[] = { 2, 8, 5, 7, 1, 4 }; int main() { int n; cin >> n; cout << s[n % 7 + 1] << endl; }