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.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.Arrays;
import java.io.InputStreamReader;
import java.io.IOException;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Artem Gilmudinov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Reader in = new Reader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, Reader in, PrintWriter out) {
            int n = in.ni();
            Integer[] x = new Integer[n];
            for (int i = 0; i < n; i++) {
                x[i] = in.ni();
            }
            Arrays.sort(x);
            ArrayList<ArrayList<Integer>> primes = new ArrayList<>();
            for (int i = 0, s = 0; i < n; ) {
                int j = i;
                primes.add(new ArrayList<>());
                for (; j < n; j++) {
                    if (x[i].equals(x[j])) {
                        primes.get(s).add(x[i]);
                    } else {
                        break;
                    }
                }
                ++s;
                i = j;
            }
            long[][] prod = new long[primes.size() + 1][2];
            prod[0][0] = 1;
            prod[primes.size()][1] = 1;
            long mod = 1_000_000_007l;
            for (int i = 1; i <= primes.size(); i++) {
                prod[i][0] = (prod[i - 1][0] * (primes.get(i - 1).size() + 1)) % (mod - 1);
            }
            for (int i = primes.size() - 1; i >= 0; i--) {
                prod[i][1] = (prod[i + 1][1] * (primes.get(i).size() + 1)) % (mod - 1);
            }
            Arrays.sort(x);
            long ans = 1;
            long p;
            for (int i = 0, s = 0; i < n; ) {
                int j = i;
                int cnt = 0;
                for (; j < n; j++) {
                    if (!x[i].equals(x[j])) {
                        break;
                    }
                    ++cnt;
                }
                p = (prod[s][0] * (prod[s + 1][1])) % (mod - 1);
                long pow = p % (mod - 1);
                for (int z = 1; z <= cnt; z++) {
                    ans = (ans * Utils.binpow(Utils.binpow(x[i], z, mod), pow, mod)) % mod;
                }
                i = j;
                s++;
            }
            out.println(ans);

        }

    }

    static class Reader {
        private BufferedReader in;
        private StringTokenizer st = new StringTokenizer("");
        private String delim = " ";

        public Reader(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            if (!st.hasMoreTokens()) {
                st = new StringTokenizer(rl());
            }
            return st.nextToken(delim);
        }

        public String rl() {
            try {
                return in.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

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

    }

    static class Utils {
        public static long binpow(long a, long pow, long mod) {
            if (pow == 0) {
                return 1;
            }
            long res = binpow(a, pow / 2, mod);
            if (pow % 2 == 0) {
                return (res * res) % mod;
            } else {
                return (((res * res) % mod) * a) % mod;
            }
        }

    }
}

