#include <bits/stdc++.h>
using ull = unsigned long long;
using ll = long long;
using ld = long double;
using namespace std;
const ll mod = 998244353;
const ll N = 2e5 + 5;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> v(n, vector<int>(m));
    int cnt = 0;
    int mn = 2e9;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        cin >> v[i][j];
        if (v[i][j] <= 0) cnt++;
        if (mn > abs(v[i][j])) mn = abs(v[i][j]);
      }
    }
    int sum = 0;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        sum += abs(v[i][j]);
      }
    }
    if (cnt % 2 == 1)
      cout << sum - 2 * mn << endl;
    else
      cout << sum << endl;
  }
}
