Given two function, one is** h(x)** which includes the **products** of all the number in an array A[ ] having size N and another function **f(x)** which denotes the **GCD **of all the numbers in an array.Your task is to find the value of **h(x) ^{f(x)}**.

**Input:**

The first line contains an integer T, the number of test cases. Then T test cases follow. Each test case contains two lines. The first line of each test case contains an integer N denoting the size of the array **A**. The Next line will contain N-space separated integer values i.e **A[i]**.

**Output:**

Print the required answer in a new line

**Constraints:**

1 <= T <= 26

1 <= N <= 60

1 <= A_{i }<= 10^{4}

**Example:**

**Input: **

1

2

2 4

**Output:**

64

**Explanation:**

**Testcase1:**Product of the array elements is 8 and GCD of the elements is 2. So 8^{2}=64.

Author: justrelax

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

jhasaurabh312 | 138 |

Aaaaarohiiii | 136 |

Harsha_kunchala | 128 |

tushki | 124 |

RajaRajput | 117 |

ARUN_PUNDIR | 617 |

manishgupta8497 | 607 |

Abhimanyu_kumar | 559 |

KhyatiSoneji | 501 |

Aman___Jain | 496 |

blackshadows | 5335 |

Ibrahim Nash | 5223 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4567 |

Login to report an issue on this page.