#include <bits/stdc++.h>
using namespace std;
int solve() {
  int n, m;
  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];
    }
  }
  int s = 0, c = 0, mn = 10000;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[i][j] < 0) {
        c++;
      }
      mn = min(mn, abs(a[i][j]));
      s += abs(a[i][j]);
    }
  }
  if (c % 2 == 0) {
    cout << s << endl;
    return 0;
  } else {
    cout << s - 2 * mn << endl;
    return 0;
  }
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
}
