#include <bits/stdc++.h>
using namespace std;
const int N = 15;
int a[N][N];
int n, m;
int res, minn = 999;
int tt;
int main() {
  int t;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    res = 0;
    tt = 0;
    minn = 999;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        cin >> a[i][j];
        res += abs(a[i][j]);
        minn = min(minn, abs(a[i][j]));
        if (a[i][j] <= 0) tt++;
      }
    }
    if (tt % 2 == 0)
      cout << res << endl;
    else
      cout << res - 2 * minn << endl;
  }
  return 0;
}
