#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, m, ne, s, i;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    int a[n * m];
    ne = 0;
    s = 0;
    for (i = 0; i < n * m; i++) {
      cin >> a[i];
      s += abs(a[i]);
      if (a[i] <= 0) {
        ++ne;
      }
      a[i] = abs(a[i]);
    }
    sort(a, a + n * m);
    if (ne % 2 == 0)
      cout << s << endl;
    else
      cout << s - 2 * a[0] << endl;
  }
  return 0;
}
