#include <bits/stdc++.h>
using namespace std;
long long a[200005];
vector<long long> greedy;
long long digitsum(long long x) {
  if (x == 0) return 0;
  return digitsum(x / 10) + x % 10;
}
void test() {
  greedy.clear();
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  reverse(a, a + n);
  for (long long i = 0; i < n && greedy.size() < 3; i++) {
    bool good = true;
    for (auto g : greedy)
      if (g % a[i] == 0) good = false;
    if (good) greedy.push_back(a[i]);
  }
  long long greedysum = 0;
  for (auto g : greedy) greedysum += g;
  bool d2 = false;
  bool d3 = false;
  bool d5 = false;
  for (long long i = 1; i < n; i++) {
    if (a[i] * 2 == a[0]) d2 = true;
    if (a[i] * 3 == a[0]) d3 = true;
    if (a[i] * 5 == a[0]) d5 = true;
  }
  long long da = a[0] / 2 + a[0] / 3 + a[0] / 5;
  if (d2 && d3 && d5 && da > greedysum) {
    cout << da << "\n";
  } else {
    cout << greedysum << "\n";
  }
}
void solve() {
  long long q;
  cin >> q;
  while (q--) test();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
}
