#include <bits/stdc++.h>
const int maxn = 1e5 + 10;
long long gcd(long long a, long long b) { return !a ? b : gcd(b % a, a); }
int f[maxn];
int fid(int x) { return f[x] == x ? x : f[x] = fid(f[x]); }
const int mod = 1e9 + 7;
const double eps = 1e-7;
using namespace std;
int a[200][200];
int b[maxn];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n, m;
    scanf("%d", &n);
    scanf("%d", &m);
    for (int i = 1; i <= n; ++i)
      for (int j = 1; j <= m; ++j) scanf("%d", &a[i][j]);
    int tot = 0;
    int lala = 0;
    long long ans = 0;
    for (int i = 1; i <= n; ++i)
      for (int j = 1; j <= m; ++j) {
        int p = a[i][j];
        if (p <= 0) {
          p = -p;
          lala++;
        }
        b[++tot] = p;
        ans += 1LL * b[tot];
      }
    sort(b + 1, b + 1 + tot);
    if (lala % 2) ans -= 2 * 1LL * b[1];
    printf("%lld\n", ans);
  }
  return 0;
}
