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