#include <bits/stdc++.h>
using namespace std;
long long cc = 0;
void boost() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
int main() {
  boost();
  long long i, j, k, n, t, x, y, d = 0, c = 0;
  long long l, r, ans, h, z, m, u, q, mm, w, mx;
  cin >> t;
  while (t--) {
    c = 0;
    d = 0;
    ans = 0;
    mm = (long long)1e18;
    cin >> n >> m;
    long long a[n][m];
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        cin >> a[i][j];
        if (a[i][j] == 0) c++;
        if (a[i][j] < 0) {
          d++;
        }
        mm = min(mm, abs(a[i][j]));
        ans += abs(a[i][j]);
      }
    }
    if (c > 0) {
      cout << ans << '\n';
    } else {
      if (d & 1) {
        ans = ans - 2 * mm;
        cout << ans << '\n';
      } else {
        cout << ans << '\n';
      }
    }
  }
  return 0;
}
