#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int _;
  for (cin >> _; _--;) {
    int n, m;
    cin >> n >> m;
    int mn = 2e9, ans = 0, cnt = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        int x;
        cin >> x;
        if (x < 0) cnt++;
        x = abs(x);
        ans += x;
        mn = min(mn, x);
      }
    }
    if (cnt % 2)
      cout << ans - 2 * mn << '\n';
    else
      cout << ans << '\n';
  }
  return 0;
}
