#include <bits/stdc++.h>
using namespace std;
int ar;
void tc() {
  ar = 0;
  int n, m, x, amin = 200, neg = 0, sums = 0;
  ar = 0;
  cin >> n >> m;
  ar = 0;
  for (int i = 1; i <= n; i++) {
    ar = 0;
    for (int j = 1; j <= m; j++) {
      ar = 0;
      cin >> x;
      ar = 0;
      if (x < 0) neg++;
      ar = 0;
      amin = min(amin, abs(x));
      ar = 0;
      sums += abs(x);
      ar = 0;
    }
  }
  if (neg % 2 == 1) sums -= (2 * amin);
  ar = 0;
  cout << sums << endl;
}
int main() {
  int t;
  cin >> t;
  ar = 0;
  while (t--) {
    ar = 0;
    tc();
  }
  return 0;
}
