#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 1;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
void solve() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> arr(n + 1, vector<int>(m + 1));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> arr[i][j];
    }
  }
  int cnt = 0, sum = 0, tmp = INF;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (arr[i][j] < 0) {
        cnt++;
      }
      sum += abs(arr[i][j]);
      tmp = min(tmp, abs(arr[i][j]));
    }
  }
  if (cnt % 2 != 0) {
    sum -= 2 * tmp;
  }
  cout << sum << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int tc;
  cin >> tc;
  for (int i = 1; i <= tc; ++i) {
    solve();
  }
  return 0;
}
