Ayrat has number n, represented as it's prime factorization pi of size m, i.e. n = p1·p2·...·pm. Ayrat got secret information that that the product of all divisors of n taken modulo 109 + 7 is the password to the secret data base. Now he wants to calculate this value.

Input

The first line of the input contains a single integer m (1 ≤ m ≤ 200 000) — the number of primes in factorization of n. 

The second line contains m primes numbers pi (2 ≤ pi ≤ 200 000).

Output

Print one integer — the product of all divisors of n modulo 109 + 7.

Examples

Input

2
2 3


Output

36


Input

3
2 3 2


Output

1728

Note

In the first sample n = 2·3 = 6. The divisors of 6 are 1, 2, 3 and 6, their product is equal to 1·2·3·6 = 36.

In the second sample 2·3·2 = 12. The divisors of 12 are 1, 2, 3, 4, 6 and 12. 1·2·3·4·6·12 = 1728.
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author shu_mj @ http://shu-mj.com
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        Scanner in;
        PrintWriter out;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            this.in = in;
            this.out = out;
            run();
        }

        void run() {
            int m = in.nextInt();
            int M = (int) (1e9 + 7);
            int N = 200_000;
            int[] cnt = new int[N + 1];
            boolean ok = true;
            int[] is = in.nextIntArray(m);
            for (int i : is) cnt[i]++;
            for (int i : cnt) if (i % 2 == 1) ok = false;
            if (ok) {
                long num = 1;
                for (int i : cnt) {
                    num *= i + 1;
                    num %= (M - 1);
                }
                for (int i = 0; i < N + 1; i++) cnt[i] /= 2;
                long mul = 1;
                for (int i = 0; i <= N; i++) {
                    int x = cnt[i];
                    while (x != 0) {
                        mul *= i;
                        mul %= M;
                        x--;
                    }
                }
                out.println(Num.pow(mul, num, M));
                return;
            }
            long mul = 1;
            for (int i : is) {
                mul *= i;
                mul %= M;
            }
            long num = 1;
            boolean f = true;
            for (int i : cnt) {
                if (i % 2 == 1 && f) {
                    f = false;
                    num *= (i + 1) / 2;
                } else {
                    num *= i + 1;
                }
                num %= (M - 1);
            }
            out.println(Num.pow(mul, num, M));
        }

    }

    static class Scanner {
        BufferedReader br;
        StringTokenizer st;

        public Scanner(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
            eat("");
        }

        private void eat(String s) {
            st = new StringTokenizer(s);
        }

        public String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        public boolean hasNext() {
            while (!st.hasMoreTokens()) {
                String s = nextLine();
                if (s == null)
                    return false;
                eat(s);
            }
            return true;
        }

        public String next() {
            hasNext();
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public int[] nextIntArray(int n) {
            int[] is = new int[n];
            for (int i = 0; i < n; i++) {
                is[i] = nextInt();
            }
            return is;
        }

    }

    static class Num {
        public static long pow(long p, long e, long mod) {
            long res = 1;
            while (e != 0) {
                if ((e & 1l) != 0) res = res * p % mod;
                p = p * p % mod;
                e >>= 1;
            }
            return res;
        }

    }
}

