#include <bits/stdc++.h>
using namespace std;
int t, n, ans, pos, mx1, mx2, two, three, five;
vector<int> arr(2e5 + 5);
int solve(int& p, int mx1, int mx2) {
  --p;
  for (; p >= 1; --p) {
    if (mx1 % arr[p] != 0 && mx2 % arr[p] != 0) {
      return arr[p];
    }
  }
  return 0;
}
int main(void) {
  ios ::sync_with_stdio(0);
  cin.tie(0);
  cin >> t;
  for (int z = 1; z <= t; ++z) {
    two = three = five = 0;
    cin >> n;
    pos = n;
    for (int i = 1; i <= n; ++i) {
      cin >> arr[i];
    }
    sort(arr.begin() + 1, arr.begin() + n + 1);
    ans = arr[n];
    mx1 = solve(pos, arr[n], arr[n]);
    mx2 = solve(pos, mx1, arr[n]);
    ans += mx1 + mx2;
    for (int i = 1; i <= n; ++i) {
      if (arr[i] * 2 == arr[n]) {
        two = true;
      } else if (arr[i] * 3 == arr[n]) {
        three = true;
      } else if (arr[i] * 5 == arr[n]) {
        five = true;
      }
    }
    if (two && three && five) {
      ans = max(ans, arr[n] / 2 + arr[n] / 3 + arr[n] / 5);
    }
    cout << ans << "\n";
  }
  return 0;
}
