#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int i, c, j, n, m, t, s, mn, co;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    c = co = 0;
    s = 0;
    int a[n][m];
    mn = 100;
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        cin >> a[i][j];
        if (a[i][j] >= 0) {
          mn = min(mn, a[i][j]);
          s = s + a[i][j];
        } else if (a[i][j] < 0) {
          c++;
          mn = min(mn, -a[i][j]);
          s = s - a[i][j];
        }
      }
    }
    if (c % 2 == 0)
      cout << s;
    else
      cout << s - (2 * mn);
    cout << "\n";
  }
  return 0;
}
