#include <bits/stdc++.h>
using namespace std;
bool count(vector<long long> a, long long x) {
  auto it = lower_bound(a.begin(), a.end(), x);
  return it != a.end() and (*it) == x;
}
void nikal_pehli_fursat_mai() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  long long ans = 0;
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  vector<long long> temp;
  for (int i = n - 1; i >= 0; i--) {
    bool check = 1;
    for (auto it : temp) {
      if (it % v[i] == 0) {
        check = 0;
        break;
      }
    }
    if (check) {
      temp.push_back(v[i]);
      if (temp.size() == 3) break;
    }
  }
  for (int i = 0; i < temp.size(); i++) ans += temp[i];
  long long mx = v[n - 1];
  if (mx % 30 == 0 and count(v, mx / 2) and count(v, mx / 3) and
      count(v, mx / 5)) {
    ans = max(ans, (mx * 31) / 30);
  }
  cout << ans << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int tc = 1;
  cin >> tc;
  while (tc--) {
    nikal_pehli_fursat_mai();
  }
}
