#include <bits/stdc++.h>
using namespace std;
long long t, n, m, ch, ans, mn = 101, otr, nul;
int main() {
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> n >> m;
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < m; k++) {
        cin >> ch;
        if (ch < 0) {
          otr++;
        }
        if (ch == 0) {
          nul++;
        }
        if (abs(ch) < mn) {
          mn = abs(ch);
        }
        ans += abs(ch);
      }
    }
    if ((otr % 2 == 0) || (otr % 2 != 0 && nul > 0)) {
      cout << ans;
    } else {
      cout << ans - mn - mn;
    }
    ans = 0;
    mn = 101;
    nul = 0;
    otr = 0;
    cout << '\n';
  }
  return 0;
}
