#include <bits/stdc++.h>
using namespace std;
int func() {
  int n, m, min = 1000;
  cin >> n >> m;
  int minus = 0;
  int buf, result = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; ++j) {
      cin >> buf;
      minus += (buf < 0);
      result += abs(buf);
      min = abs(buf) < min ? abs(buf) : min;
    }
  }
  if (minus % 2 == 1) result -= min * 2;
  return result;
}
int main() {
  int t, b;
  cin >> t;
  vector<int> result(t);
  for (int i = 0; i < t; ++i) {
    result[i] = func();
  }
  for (int i = 0; i < t; ++i) {
    cout << result[i] << '\n';
  }
  return 0;
}
