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.
//package com.company.Practice.Ladder;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Locale;
import java.util.Objects;
import java.util.Random;
import java.util.StringTokenizer;


public class ArpaA {

        Random random = new Random(751454315315L + System.currentTimeMillis());

        public void solve() throws IOException {
            int n = nextInt();
            int a = 8;
            int res = power(8, n);
            out.println(res);
        }
        public int power(int base, int n) {
            int res = 1;
            while (n>0) {
                if (n % 2==1){
                    res = (res * base) % 10;
                    n--;
                }else {
                    base = (base * base) % 10;
                    n /= 2;
                }
            }
            return res;
        }

        public void run() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);

                solve();

                out.close();
            } catch (IOException e) {
                e.printStackTrace();
                System.exit(1);
            }
        }

        private void shuffle(int[] s) {
            for (int i = 0; i < s.length; ++i) {
                int j = random.nextInt(i + 1);
                int t = s[i];
                s[i] = s[j];
                s[j] = t;
            }
        }

        class Pair implements Comparable<Pair> {
            int f;
            int s;

            public Pair(int f, int s) {
                this.f = f;
                this.s = s;
            }

            @Override
            public boolean equals(Object o) {
                if (this == o) return true;
                if (o == null || getClass() != o.getClass()) return false;
                Pair pair = (Pair) o;
                return f == pair.f &&
                        s == pair.s;
            }

            @Override
            public int hashCode() {
                return Objects.hash(f, s);
            }

            @Override
            public int compareTo(Pair o) {
                if (f == o.f) {
                    return s - o.s;
                }
                return f - o.f;
            }
        }

        BufferedReader br;
        StringTokenizer in;
        PrintWriter out;

        public String nextToken() throws IOException {
            while (in == null || !in.hasMoreTokens()) {
                in = new StringTokenizer(br.readLine());
            }
            return in.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(nextToken());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(nextToken());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(nextToken());
        }

        public int[] nextArr(int n) throws IOException {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public static void main(String[] args) throws IOException {
            Locale.setDefault(Locale.US);
             new ArpaA().run();
        }
    }