#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10, inf = 0x3f3f3f3f;
int T, n, a[N];
int main() {
  cin >> T;
  while (T--) {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    sort(a + 1, a + n + 1);
    int ans = 0;
    ans = max(ans, a[n]);
    bool f1 = false, f2 = false, f3 = false;
    for (int i = 1; i <= n; i++) {
      if (a[i] * 2 == a[n]) f1 = true;
      if (a[i] * 3 == a[n]) f2 = true;
      if (a[i] * 5 == a[n]) f3 = true;
    }
    if (f1 && f2 && f3) ans = max(ans, a[n] / 2 + a[n] / 3 + a[n] / 5);
    int val = a[n];
    for (int i = 1; i <= n; i++)
      if (val % a[i] == 0) a[i] = inf;
    sort(a + 1, a + n + 1);
    while (a[n] == inf) n--;
    for (int i = 1; i < n; i++)
      if (a[n] % a[i]) ans = max(ans, val + a[n] + a[i]);
    ans = max(ans, val + a[n]);
    printf("%d\n", ans);
  }
  return 0;
}
