#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 8;
const int mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    long long arr[n][m];
    long long x = 0;
    for (long long i = 0; i < (n); i++) {
      for (long long j = 0; j < (m); j++) {
        cin >> arr[i][j];
        if (arr[i][j] < 0) {
          x++;
        }
      }
    }
    long long ans = 0;
    long long minval = 101;
    for (long long i = 0; i < (n); i++) {
      for (long long j = 0; j < (m); j++) {
        ans += abs(arr[i][j]);
        minval = min(minval, abs(arr[i][j]));
      }
    }
    if (x % 2 != 0) {
      ans -= 2 * minval;
    }
    cout << ans << endl;
  }
}
