#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono;
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  long long first = 0;
  cerr << '{';
  for (auto &i : x) cerr << (first++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
ll power(ll a, ll p, ll m = 1000000007) {
  ll res = 1;
  while (p > 0) {
    if (p & 1) res = (res * a) % m;
    a = (a * a) % m;
    p >>= 1;
  }
  return res;
}
long long ceil(long long a, long long b) {
  if (a % b == 0)
    return a / b;
  else
    return a / b + 1;
}
long long pow(long long a, long long b) {
  if (b == 0) return 1;
  long long res = pow(a, b / 2);
  res = res * res;
  if (b & 1) res *= a;
  return res;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    vector<vector<long long> > v(n, vector<long long>(m));
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < m; j++) cin >> v[i][j];
    }
    long long count = 0;
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < m; j++) {
        if (v[i][j] < 0) count++;
      }
    }
    long long totalsum = 0;
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < m; j++) {
        totalsum += abs(v[i][j]);
      }
    }
    long long mi = 1000000007;
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < m; j++) {
        mi = min(abs(v[i][j]), mi);
      }
    }
    if (count & 1 ^ 1) {
      cout << totalsum << '\n';
    } else {
      totalsum -= 2 * mi;
      cout << totalsum << '\n';
    }
  }
  return 0;
}
