#include <bits/stdc++.h>
using namespace std;
int t, n, a[200005];
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      ans = max(ans, a[i]);
    }
    sort(a + 1, a + n + 1);
    int an = a[n];
    bool flag1 = 0, flag2 = 0, flag3 = 0;
    for (int i = 1; i <= n; i++) {
      if (a[i] * 2 == an) flag1 = 1;
      if (a[i] * 3 == an) flag2 = 1;
      if (a[i] * 5 == an) flag3 = 1;
    }
    if (flag1 && flag2 && flag3) ans = max(ans, an / 2 + an / 3 + an / 5);
    for (int i = 1; i <= n; i++)
      if (a[n] % a[i] == 0) a[i] = 2000000000;
    sort(a + 1, a + n + 1);
    while (a[n] == 2000000000) n--;
    ans = max(ans, an + a[n]);
    for (int i = 1; i <= n; i++)
      if (a[n] % a[i] != 0) ans = max(ans, an + a[n] + a[i]);
    printf("%d\n", ans);
  }
  return 0;
}
