#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, m, f = 0, o = 0, mi = INT_MAX, k = 0, sum = 0;
    cin >> n >> m;
    int a[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cin >> a[i][j];
        if (a[i][j] == 0)
          f = 1;
        else {
          if (a[i][j] < 0) o++;
          k = abs(a[i][j]);
          sum += k;
          mi = min(mi, k);
        }
      }
    }
    if (f || o % 2 == 0)
      cout << sum << "\n";
    else
      cout << sum - (2 * mi) << "\n";
  }
  return 0;
}
