#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, m, n, z, s, q, p;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    int a[n][m], z = 200, s = 0, p = 0;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        cin >> a[i][j];
        if (a[i][j] < 0) {
          ++p;
        }
        z = min(z, abs(a[i][j]));
        s = s + abs(a[i][j]);
      }
    }
    if (p % 2 == 1) {
      s = s - 2 * z;
      cout << s << endl;
    } else
      cout << s << endl;
  }
}
