#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
#define debug cout<<"HERE"<<endl;
void edm()
{
ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("outputtt.txt","w",stdout);
#endif
}
map<int,int>mp;
int n;
int arr[15];
const int mod = 1e9+7;
void idk(int ind,int g,int koyta)
{
if(ind==n)
{
mp[koyta] += g;
return;
}
int gg = __gcd(g,arr[ind]);
idk(ind+1,gg,koyta+1);
idk(ind+1,g,koyta);
}
void solve()
{
cin>>n;
for(int i=0;i<n;i++)cin>>arr[i];
idk(0,0,0);
int ans=1;
for(auto i:mp)
{
if(i.ss)
{
ans = ans * i.ss;
ans = ans % mod;
}
// cout<<i.ff<<" "<<i.ss<<endl;
}
cout<<ans<<endl;
mp.clear();
}
int32_t main()
{
//edm();
int t = 1;
cin>>t;
for(int i=1;i<=t;i++)
{
solve();
}
}