#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
typedef long long ll;
typedef unsigned int ull;
typedef long double lld;
#define int long long
/*---------------------------------------------------------------------------------------------------------------------------------------------*/
#ifdef ONLINE_JUDGE
#define debug(x)
#else
#define debug(x) \
cerr << #x << " "; \
_print(x); \
cerr << endl;
#endif
#define int long long
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define fastio() \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define INF 1e18
#define nline "\n"
#define pb push_back
#define ppb pop_back
#define ff first
#define ss second
#define PI 3.141592653589793238462
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define setbits(x) __builtin_popcountll(x)
const int MOD = 1e9 + 7;
void _print(ll t) { cerr << t; }
void _print(string t) { cerr << t; }
void _print(char t) { cerr << t; }
void _print(lld t) { cerr << t; }
void _print(double t) { cerr << t; }
void _print(ull t) { cerr << t; }
template <class T, class V>
void _print(pair<T, V> p);
template <class T>
void _print(vector<T> v);
template <class T>
void _print(set<T> v);
template <class T, class V>
void _print(map<T, V> v);
template <class T>
void _print(multiset<T> v);
template <class T, class V>
void _print(pair<T, V> p)
{
cerr << "{";
_print(p.ff);
cerr << ",";
_print(p.ss);
cerr << "}";
}
template <class T>
void _print(vector<T> v)
{
cerr << "[ ";
for (T i : v)
{
_print(i);
cerr << " ";
}
cerr << "]";
}
template <class T>
void _print(set<T> v)
{
cerr << "[ ";
for (T i : v)
{
_print(i);
cerr << " ";
}
cerr << "]";
}
template <class T>
void _print(multiset<T> v)
{
cerr << "[ ";
for (T i : v)
{
_print(i);
cerr << " ";
}
cerr << "]";
}
template <class T, class V>
void _print(map<T, V> v)
{
cerr << "[ ";
for (auto i : v)
{
_print(i);
cerr << " ";
}
cerr << "]";
}
vector<int> vinput(int n)
{
vector<int> v(n);
for (int i = 0; i < n; i++)
{
cin >> v[i];
}
return v;
}
void printVector(vector<int> &v)
{
for (int i = 0; i < v.size(); i++)
{
cout << v[i] << " ";
}
cout << '\n';
}
int ceilCustom(int a, int b)
{
return (a + b - 1) / b;
}
/*-------------------------- CODE HERE -------------------------------------------------------------------------------------------------------------------*/
bool isPalindrome(string v, int l, int r)
{
while (l < r)
{
if (v[l++] != v[r--])
return false;
}
return true;
}
bool possible(vector<int>& cnt, int rem) {
int mx = *max_element(cnt.begin(), cnt.end());
return mx <= (rem + 1) / 2;
}
void solve() {
int n;
cin >> n;
priority_queue<int> pq;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
pq.push(x);
}
int s = 0, flag = 0, move = 0;
while (!pq.empty() && pq.top() > 0) {
int x = pq.top();
if (x < 0 && move >= 2) {
break;
}
pq.pop();
if (flag == 0) s += x;
else s -= x;
move++;
flag ^= 1;
}
cout << s << '\n';
}
signed main()
{
fastio();
int t = 1;
cin >> t;
while (t--)
{
solve();
}
return 0;
}