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