#include<bits[表情]dc++.h>
#define int long long
#define endl '\n'
#define mod 998244353
#define ffor(n) for(int i = 0;i < n;++i)
const int N = 2000006;
using namespace std;
void build_log();
int mv_x[4] = {1,0,-1,0};
int mv_y[4] = {0,1,0,-1};
int year[2][15] = {{31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,30,31,31,30,31,30,31}};//1æ¯é°å¹´,0æ¯éé°å¹´
int t;
int m_log2[500005]; // log2(x) + 1
int k;
int n,m;
int h;
vector<int>v;
signed main()
{
//ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
cin>>t;
while(t--)
{
cin>>n;
int a;
int sum = 0;
int mmin = 10000000000;
int mmax = -10000000000;
ffor(n)
{
cin>>a;
if(a < 0)
{
sum -= a;
}
else
{
sum += a;
}
mmin = min(mmin,a);
mmax = max(mmax,a);
}
if(mmin > 0)
{
sum -= 2 * mmin;
}
if(mmax < 0)
{
sum += mmax*2;
}
cout<<sum<<endl;
}
return 0;
}
void build_log()
{
for(int i = 1;i <= n;i++)
{
m_log2[i] = m_log2[i-1] + ((1 << m_log2[i-1]) == i);
}
}