#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define TOSTRING(x) #x #define SZ(x) (int)(x).size() #define REP(i,n) for(int i=0;i<(n);i++) #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REPR(i,n) for(int i=(n)-1;i>=0;i--) #define ALL(s) (s).begin(), (s).end() #define so(V) sort(ALL(V)) #define rev(V) reverse(ALL(V)) #define uni(v) v.erase( unique(ALL(v)) , v.end()); #define PAU system("pause") typedef long long unsigned int llu; typedef long long ll; typedef vector vi; typedef vector vll; typedef vector vb; typedef vector vvi; typedef vector vvll; typedef vector vvb; const double EPS = 1e-9; const int MOD = 1e9 + 7; const int INF = (1 << 28); const double PI = acos(-1); int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; N--; int a[6] = { 2,8,5,7,1,4 }; cout << a[N % 6] << endl; PAU; return 0; }