#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t, m;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    int arr[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cin >> arr[i][j];
      }
    }
    int sum = 0, count = 0, val = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        sum += abs(arr[i][j]);
        if (arr[i][j] < 0) count++;
        if (i == 0 && j == 0)
          val = min(abs(arr[i][j]), abs(arr[0][0]));
        else
          val = min(val, abs(arr[i][j]));
      }
    }
    if (count % 2 == 0)
      cout << sum << endl;
    else
      cout << sum - 2 * val << endl;
  }
  return 0;
}
