#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, m;
    cin >> n >> m;
    long long int a[n][m];
    long long int mn = INT_MAX;
    long long int sum = 0;
    long long int negative = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cin >> a[i][j];
        mn = min(abs(a[i][j]), mn);
        sum += abs(a[i][j]);
        if (a[i][j] < 0) {
          negative++;
        }
      }
    }
    if (negative % 2 == 0) {
      cout << sum << endl;
      continue;
    } else {
      cout << sum - 2 * mn << endl;
      continue;
    }
  }
}
