#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m;
  cin >> n >> m;
  long long a[n][m];
  long long mn = INT_MAX;
  long long cnt = 0;
  bool zero = false;
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      cin >> a[i][j];
      mn = min(mn, abs(a[i][j]));
      sum += abs(a[i][j]);
      if (a[i][j] < 0) {
        cnt++;
      }
      if (a[i][j] == 0) zero = true;
    }
  }
  if (cnt % 2 && !zero) {
    cout << sum - 2 * mn << endl;
  } else {
    cout << sum << endl;
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
