#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    int aa[n][m];
    int mi = 1001, c = 0, sum = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cin >> aa[i][j];
        if (aa[i][j] < 0) c++;
        sum += abs(aa[i][j]);
        mi = min(mi, abs(aa[i][j]));
      }
    }
    if (c % 2 == 0)
      cout << sum << endl;
    else
      cout << sum - (2 * mi) << endl;
  }
  return 0;
}
