#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    long long a[n][m];
    long long mn = (1LL << 60), cnt = 0, sum = 0;
    for (long long i = 0; i < n; i++)
      for (long long j = 0; j < m; j++)
        cin >> a[i][j], cnt += (a[i][j] < 0), mn = min(mn, abs(a[i][j])),
                                              sum += abs(a[i][j]);
    if (cnt & 1) {
      cout << sum - 2 * mn << "\n";
    } else {
      cout << sum << "\n";
    }
  }
}
