#include <bits/stdc++.h>
using namespace std;
long long ar[11][11];
void solve() {
  long long n, m, neg = 0, s = 0, mn = INT_MAX;
  cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      cin >> ar[i][j];
      if (ar[i][j] < 0) neg++;
      mn = min(mn, abs(ar[i][j]));
      s += abs(ar[i][j]);
    }
  }
  if (neg & 1) s -= 2 * mn;
  cout << s << '\n';
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
