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