#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  cin >> n >> m;
  int a[10][10];
  bool zero = 0;
  int minus = 0, sum = 0, mn = 101;
  for (int i = 0; (1 == 1 ? i <= n - 1 : i >= n - 1); i += 1) {
    for (int j = 0; (1 == 1 ? j <= m - 1 : j >= m - 1); j += 1) {
      cin >> a[i][j];
      if (a[i][j] == 0) zero = 1;
      if (a[i][j] < 0) minus++;
      mn = min(mn, abs(a[i][j]));
      sum += abs(a[i][j]);
    }
  }
  if (zero) {
    cout << sum << '\n';
    return;
  }
  cout << sum + -1 * 2 * (minus % 2) * mn << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
