#include <bits/stdc++.h>
#define int long long
using namespace std;
/*
OBSERVATIONS:
FOR EVERY CURRGCD I WILL TAKE CURRG ELEMENTS USING RECURSION AND ADD THEM TO THE RESULT
AND RETURN AND IN THE MAIN I WILL MULTIPLE THEM WITH RES
*/
const int mod = (int)(1e9 + 7);
int dfs(vector<int> &arr, int index, int k, int currgcd)
{
if (index >= arr.size())
{
if (k == 0)
return currgcd;
else
return 0;
}
if (k == 0)
{
return currgcd;
}
int res = 0;
// either i skip this element
res = dfs(arr, index + 1, k, currgcd);
if (currgcd == -1)
{
// first element
res = (res + dfs(arr, index + 1, k - 1, arr[index]));
}
else
{
int newgcd = __gcd(currgcd, arr[index]);
res = (res + dfs(arr, index + 1, k - 1, newgcd));
}
return res;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
vector<int> arr(n);
for (int i = 0; i < n; i++)
cin >> arr[i];
int res = 1;
for (int currg = 1; currg <= n; currg++)
{
int curr = dfs(arr, 0, currg, -1);
// cout << curr << endl;
res = (res * curr) % mod;
}
cout << res << endl;
}
return 0;
}