#include <bits/stdc++.h>
using namespace std;
const long long IMAX = 1000000000000000000;
void solve() {
  int mat[10][10];
  int n, m, cnt = 0, mn = 1000, sm = 0;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> mat[i][j];
      mn = min(mn, abs(mat[i][j]));
      sm += abs(mat[i][j]);
      if (mat[i][j] < 0) cnt++;
    }
  }
  if (cnt % 2 == 0)
    cout << sm << "\n";
  else {
    cout << sm - mn - mn << "\n";
  }
}
int main() {
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
