#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    int arr[n][m], i, j, mi = 101, sum = 0, num = 0, zero = 0;
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        cin >> arr[i][j];
        mi = min(mi, abs(arr[i][j]));
        sum += abs(arr[i][j]);
        if (arr[i][j] < 0) num++;
        if (arr[i][j] == 0) zero++;
      }
    }
    if (num % 2 == 0 || zero > 0)
      cout << sum << "\n";
    else
      cout << sum - 2 * mi << "\n";
  }
  return 0;
}
