There exists an island called Arpa’s land, some beautiful girls live there, as ugly ones do.

Mehrdad wants to become minister of Arpa’s land. Arpa has prepared an exam. Exam has only one question, given n, print the last digit of 1378n. 

<image>

Mehrdad has become quite confused and wants you to help him. Please help, although it's a naive cheat.

Input

The single line of input contains one integer n (0 ≤ n ≤ 109).

Output

Print single integer — the last digit of 1378n.

Examples

Input

1


Output

8

Input

2


Output

4

Note

In the first example, last digit of 13781 = 1378 is 8.

In the second example, last digit of 13782 = 1378·1378 = 1898884 is 4.
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
//BigInteger A;
//A= BigInteger.valueOf(54);
//ArrayList<Integer> a=new ArrayList<>();
//TreeSet<Integer> ts=new TreeSet<>();
//HashMap<Integer,Integer> hm=new HashMap<>();
//PriorityQueue<Integer> pq=new PriorityQueue<>();
public final class CF
{
    public static long fun(int n)
    {
        if(n==0)
        return 1;
        long x=fun(n/2);
        if(n%2==0)
        return (x%10*x%10)%10;
        return (8*(x%10*x%10)%10)%10;
    }
   public static void main(String[]args)throws IOException
	{
		//int K=(int)Math.pow(10,9)+7;
          FastReader ob=new FastReader();
          StringBuffer sb=new StringBuffer();
          //int t=ob.nextInt();
          //while(t-->0)
          {
            int n=ob.nextInt();
            //fun(n)
            System.out.println(fun(n));
            //sb.append(n+"\n");
          }
          System.out.println(sb);
	}
}
class Pair
{
	int x,y;
	Pair(int x,int y)
	{
		this.x=x;
		this.y=y;
	}
}
class PairComparator implements Comparator<Pair>
{
	public int compare(Pair a,Pair b)
	{
        return a.y-b.y;
	}
}
class FastReader {
    BufferedReader br;
    StringTokenizer st;
    public FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    public String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e)  {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }
    public String nextLine()
    {
        String s="";
        try {
        s=br.readLine();
        } catch (IOException e)  {
                e.printStackTrace();
            }
        return s;
    }
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public long nextLong() {
        return Long.parseLong(next());
    }
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}