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.util.*;
import java.io.*;
public class Multiplierss {
    
    
    
    /************************ SOLUTION STARTS HERE ************************/
    
    static final int mod = (int) (1e9) + 7; // Default
    static class MMInt {       // MM (Modular Math) class 
        static int sub(int a, int b , int mod) {return (a - b  + mod) % mod;}
        static int mul(int a, int b , int mod) {return (int) ((1L * a * b ) % mod);}
        static int add(int a, int b , int mod) {return (a + b) % mod;}
        static int modPow(long a , long b , long mod) {
            long pow = 1;
            while(b > 0) {
                if((b & 1L) == 1)
                    pow = ((pow * a) % mod);

                a = ((a * a) % (mod));
                b >>= 1;
            }
            return (int) pow;
        }
    }
    
    private static void solve() {
        
        int m = nextInt();
        int primes[] = nextIntArray(m);
        
        int MAX = (int) 2e5;
        int freq[] = new int[MAX + 1];
        for(int p : primes) 
            freq[p]++;
        
        TreeSet<Integer> set = new TreeSet<>(); 
        Arrays.stream(primes).forEach(set::add);
        int pSorted[] = new int[set.size()];
        int ptr = 0;
        for(int p : set)
            pSorted[ptr++] = p;
        
        int left = 1;
        int right[] = new int[set.size()];
        right[set.size() - 1] = 1;
        for(int i = pSorted.length - 2; i >= 0; i--)
            right[i] = MMInt.mul(right[i + 1], freq[pSorted[i + 1]] + 1, mod - 1);
        
        int ans = 1;
        for(int i = 0; i < pSorted.length; i++) {
            int p = pSorted[i];
            // println(p + " == " + freq[p]);
            int pow = p;
            int ways = MMInt.mul(left, right[i], mod - 1);
            for(int j = 0; j < freq[p]; j++) {
                // println("pow " + pow);
                ans = MMInt.mul(ans, MMInt.modPow(pow, ways , mod) , mod);
                pow = MMInt.mul(pow, p , mod);
            }
            left = MMInt.mul(left, freq[p] + 1 , mod - 1);
        }
        
        println(ans);
    }
    
    
    
    /************************ SOLUTION ENDS HERE ************************/
    
    
    
    
    
    /************************ TEMPLATE STARTS HERE **********************/
    
    public static void main(String[] args) throws IOException {
        reader = new BufferedReader(new InputStreamReader(System.in));
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
        st     = null;
        solve();
        reader.close();
        writer.close();
    }
    
    static BufferedReader reader;
    static PrintWriter    writer;
    static StringTokenizer st;
    
    static String next()
    {while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}            
    st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
    static String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}             
    static int    nextInt()   {return Integer.parseInt(next());}
    static long   nextLong()  {return Long.parseLong(next());}     
    static double nextDouble(){return Double.parseDouble(next());}
    static char   nextChar()  {return next().charAt(0);}
    static int[]  nextIntArray(int n)         {int[] a= new int[n];   int i=0;while(i<n){a[i++]=nextInt();}  return a;}
    static long[] nextLongArray(int n)        {long[]a= new long[n];  int i=0;while(i<n){a[i++]=nextLong();} return a;}    
    static int[]  nextIntArrayOneBased(int n) {int[] a= new int[n+1]; int i=1;while(i<=n){a[i++]=nextInt();} return a;}            
    static long[] nextLongArrayOneBased(int n){long[]a= new long[n+1];int i=1;while(i<=n){a[i++]=nextLong();}return a;}            
    static void   print(Object o)  { writer.print(o);  }
    static void   println(Object o){ writer.println(o);}
    
    /************************ TEMPLATE ENDS HERE ************************/
    
}