#include <bits/stdc++.h>
using namespace std;
inline long long mod(long long n) {
  long long ret = n % int(1e9 + 7);
  if (ret < 0) ret += int(1e9 + 7);
  return ret;
}
void solve() {
  int i, n, m, j;
  cin >> n >> m;
  int a[n][m];
  int min1 = INT_MAX, flag = 0;
  long long sum = 0;
  int neg = 0;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) cin >> a[i][j];
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (a[i][j] == 0) flag = 1;
      if (a[i][j] < 0) neg++;
      sum = sum + abs(a[i][j]);
      min1 = min(min1, abs(a[i][j]));
    }
  }
  if (flag == 1 || neg % 2 == 0) {
    cout << sum;
    return;
  }
  cout << sum - (2 * min1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    solve();
    cout << '\n';
  }
}
