Product of GCDs
题号:NC223368
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

ZYT loves GCD(greatest common divisor).

One day, LBC gives him multiple number set , and asks him to calculate the product of greatest common divisors of its each non-empty subsets of size .

In other words, for a number set , let's define .Now ZYT should calculate , where .

Because the answer is very large, we should output the result of the answer modulo .

输入描述:

The input consists of multiple test cases. The first line contains an integer  — the number of test cases.

In each testcase, the first line contains three integers .

The second line contains  integers , representing the   elements of .

输出描述:

For each test case,output one line containing one integer: .
示例1

输入

复制
1
5 2 20040220
2 4 8 12 14

输出

复制
8192

备注:

It is guaranteed that .

It is not guaranteed that the elements in  are distinct.