#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int arr[n];
    for (int i = 0; i < n; i++) cin >> arr[i];
    sort(arr, arr + n);
    long long int first = arr[n - 1];
    long long int second = 0, third = 0;
    int i;
    for (i = n - 2; i >= 0; i--) {
      if (first % arr[i] != 0) {
        second = arr[i];
        break;
      }
    }
    i--;
    for (; i >= 0; i--) {
      if (first % arr[i] != 0 && second % arr[i] != 0) {
        third = arr[i];
        break;
      }
    }
    long long int ans1 = first + second + third;
    long long int ans2 = 0;
    set<int> s;
    for (int i = 0; i < n; i++) s.insert(arr[i]);
    if (first % 2 == 0 && first % 3 == 0 && first % 5 == 0) {
      if (s.find(first / 2) != s.end() && s.find(first / 3) != s.end() &&
          s.find(first / 5) != s.end()) {
        ans2 = max(ans2, first / 2 + first / 3 + first / 5);
      }
    }
    cout << max(ans1, ans2) << endl;
  }
}
