12
 1378
 51202278
 989898989
 4
 7
 9
 6
 8
 12193721
 999999995
 999999999
 11
 999999996
 999999998
 3
 14
 15
 10
 999999994
 1000
 13781378
 5
 999999997
 1000000000
 13
 16
 0

6
 4
 4
 8
 6
 2
 8
 4
 6
 8
 2
 2
 2
 6
 4
 2
 4
 2
 4
 4
 6
 4
 8
 8
 6
 8
 6
 1

/*
What ?!?!
Ohhh....
Mmmmm....
Aaa yeee
It'll be easy for me.
By Daniyar Kuttymbek

*/
# include <bits/stdc++.h>

# define f first
# define s second
# define pb push_back
# define mp make_pair
# define int long long
# define sc(x) scanf("%I64d",&x)
# define pr(x) printf("%I64d\n",x)
# define For(x,y,z) for(int x = y;x <= z;x ++)
# define all(x) (x.begin(),x.end())
# define sz(x) x.size()
# define forn(x,y,z) for(int x = y;x >= z; x--)
# define sort(x,n) sort(x + 1,x + n + 1)
# define rev(x,n) reverse(x + 1,x + n + 1)
# define EZPZ return 0
# define pii pair <int,int>

using namespace std;

const int Inf = 1e9 + 7;
const int Imp = -1;
const int MaxN = 1e5 + 1;
int g_w[MaxN],g_b[MaxN],sz = 1,dp[2][MaxN],u[MaxN];
vector <int> g[MaxN],comp[MaxN];
main ()
{
    int n;
    sc(n);
    if(n == 0)
    pr(1ll);
    if(n % 4 == 0)
    pr(6ll);
    else if(n % 3 == 0)
    pr(2ll);
    else if(n % 2 == 0)
    pr(4ll);
}
