#include <bits/stdc++.h>
using namespace std;
int q, n, a[200000 + 5], cnt[200000 + 5];
int main() {
  scanf("%d", &q);
  for (; q--;) {
    memset(cnt, 0, sizeof(cnt));
    int sum1 = 0, sum2 = 0, tot = 0, m = 0;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      cnt[a[i]]++;
      m = max(a[i], m);
    }
    if (m % 30 == 0 && cnt[m / 2] && cnt[m / 3] && cnt[m / 5])
      sum1 = m / 30 * 31;
    for (int i = 200000; i >= 1; i--)
      if (cnt[i]) {
        for (int j = i - 1; j >= 1; j--)
          if (i % j == 0) cnt[j] = 0;
        tot++;
        sum2 += i;
        if (tot == 3) break;
      }
    printf("%d\n", max(sum1, sum2));
  }
  return 0;
}
