#include <bits/stdc++.h>
using namespace std;
int q, n;
int a[200005], ans, t, ans1, ans2, pas1, pas2, pas3;
int main() {
  cin >> q;
  while (q--) {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    sort(a + 1, a + n + 1);
    ans2 = t = a[n];
    for (int i = n; i >= 1; i--) {
      if (a[i] * 2 == a[n]) pas1 = 1;
      if (a[i] * 3 == a[n]) pas2 = 1;
      if (a[i] * 5 == a[n]) pas3 = 1;
      if (pas1 == 1 && pas2 == 1 && pas3 == 1) break;
    }
    if (pas1 == 1 && pas2 == 1 && pas3 == 1)
      ans1 = a[n] / 2 + a[n] / 3 + a[n] / 5;
    for (int i = 1; i <= n; i++)
      if (a[n] % a[i] == 0) a[i] = 2e9;
    sort(a + 1, a + n + 1);
    while (a[n] == 2e9) n--;
    ans2 = max(ans2, t + a[n]);
    for (int i = 1; i <= n; i++) {
      if (a[n] % a[i] != 0) ans2 = max(ans2, t + a[n] + a[i]);
    }
    ans = max(ans1, ans2);
    cout << ans << endl;
  }
  return 0;
}
