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