#include <bits/stdc++.h>
using namespace std;
void main2() {
  long long int n, m, sum = 0, t = INT_MAX, temp, r = 0;
  cin >> n >> m;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      cin >> temp;
      if (temp < 0) r++;
      sum += abs(temp);
      t = min(t, abs(temp));
    }
  }
  if (r % 2 == 0)
    cout << sum << "\n";
  else
    cout << sum - 2 * t << "\n";
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t = 1;
  cin >> t;
  while (t--) {
    main2();
  }
  return 0;
}
