#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int a[maxn];
int t, n, m;
int cnt, tot;
int main() {
  std::ios::sync_with_stdio(false);
  cin >> t;
  while (t--) {
    cin >> n >> m;
    cnt = 0;
    tot = 0;
    for (int i = 1; i <= n * m; i++) {
      int p;
      cin >> p;
      if (p < 0) cnt++;
      a[i] = abs(p);
      tot += a[i];
    }
    sort(a + 1, a + n * m + 1);
    if (cnt % 2)
      cout << tot - 2 * a[1] << endl;
    else
      cout << tot << endl;
  }
  return 0;
}
