#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long N = 1e4 + 5;
long long power(long long x, long long n) {
  if (n == 0) return 1;
  if (n % 2 == 0)
    return (power(x, n / 2) * power(x, n / 2)) % mod;
  else
    return ((x * power(x, n / 2)) % mod * power(x, n / 2) % mod) % mod;
}
void solve() {
  int n, m;
  cin >> n >> m;
  int a[n][m];
  int cnt = 0, mini = INT_MAX, sum = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
      if (a[i][j] < 0) cnt++;
      mini = min(mini, abs(a[i][j]));
      sum += abs(a[i][j]);
    }
  }
  if (cnt & 1) {
    sum -= 2 * mini;
  }
  cout << sum << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
