#include <bits/stdc++.h>
using namespace std;
int t = 1, T;
int mod = 1e9 + 7;
int INF = 1e9;
void solve() {
  int n, m;
  cin >> n >> m;
  long long int v[n][m];
  long long int neg = 0, zero = 0;
  long long int maxNeg = -200, minPos = 200;
  long long int sum = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> v[i][j];
      if (v[i][j] == 0)
        zero++;
      else if (v[i][j] < 0) {
        neg++;
        maxNeg = max(maxNeg, v[i][j]);
      } else {
        minPos = min(minPos, v[i][j]);
      }
      sum += abs(v[i][j]);
    }
  }
  if ((neg & 1 && zero > 0) || !(neg & 1)) {
    cout << sum << '\n';
  } else {
    sum = max(sum + 2 * maxNeg, sum - 2 * minPos);
    cout << sum << '\n';
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> t;
  T = t;
  while (t--) {
    solve();
  }
  return 0;
}
