#include <bits/stdc++.h>
using namespace std;
void cheack() {
  int n, m;
  cin >> n >> m;
  int temp;
  int numberofminus = 0;
  int sum = 0;
  int smallestnumber = 101;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> temp;
      if (temp < 0) {
        numberofminus++;
        temp = -temp;
      }
      sum += temp;
      smallestnumber = min(smallestnumber, temp);
    }
  }
  if (numberofminus % 2 == 0) {
    cout << sum << endl;
  } else {
    cout << sum - (2 * smallestnumber) << endl;
  }
}
int main() {
  int t;
  cin >> t;
  while (t-- > 0) {
    cheack();
  }
  return 0;
}
