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