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