#include <bits/stdc++.h>
const int MOD = 1e9 + 7;
const int mx = 1e6 + 5;
const long long INF = 1e18 + 3;
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    int sum = 0, fl = 0, x, mini = 1e9;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cin >> x;
        if (x < 0) {
          x = -x;
          fl++;
        }
        sum += x;
        mini = min(mini, x);
      }
    }
    if (fl % 2)
      cout << sum - 2 * mini << "\n";
    else
      cout << sum << "\n";
  }
  return 0;
}
