#include <bits/stdc++.h>   using namespace std;   int main() {     int q;     cin >> q;     while (q--) {       int n;       cin >> n;       vector<int> v(n);       set<int> st;       for (int i = 0; i < n; i++) {         cin >> v[i];         st.insert(v[i]);       }       sort(v.begin(), v.end());       int mx = v.back();       int ans = mx;       if (mx % 2 == 0 && mx % 3 == 0 && mx % 5 == 0) {         if (st.find(mx / 2) != st.end() && st.find(mx / 3) != st.end() &&             st.find(mx / 5) != st.end()) {           ans = max(ans, mx / 2 + mx / 3 + mx / 5);         }       }       vector<int> tmp;       while (!st.empty() && tmp.size() < 3) {         int x = *st.rbegin();         st.erase(prev(st.end()));         bool f = 1;         for (auto it : tmp) {           if (it % x == 0 || x % it == 0) f = 0;         }         if (f) tmp.push_back(x);       }       int sum = 0;       for (auto it : tmp) sum += it;       ans = max(ans, sum);       cout << ans <<   n ;     }   }   