#include using namespace std; #define int ll #define fast_io cin.tie(0)->sync_with_stdio(0); #define endl '\n' typedef long long ll; int32_t main() { fast_io; int t; cin >> t; while (t--) { int n; cin >> n; vector a(n); for (auto &i : a) cin >> i; sort(a.rbegin(), a.rend()); int mx = a[0]; int s = accumulate(a.begin() + 1, a.end(), 0ll); cout << mx + max(mx, s) << endl; } }