#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, n) FOR(i, 0, n) #define SORT(c) sort((c).begin(), (c).end()) #define INF (ll)1e18 #define MOD (ll)1e9 + 7 #define pb push_back typedef long long ll; typedef long long int llt; typedef pair P; typedef vector V; typedef map M; char dif = 'A' - 'a'; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; int a = n % 6; string s = "285714"; cout << s[a - 1] << endl; return 0; }