#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, s, t, test, n, m, z, l, k, sum;
  int ara[105][105];
  scanf("%d", &test);
  for (z = 1; z <= test; z++) {
    scanf("%d %d", &n, &m);
    s = 0;
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        scanf("%d", &ara[i][j]);
        if (ara[i][j] < 1) {
          s++;
          ara[i][j] = ara[i][j] * -1;
        }
      }
    }
    t = 1000;
    if (s % 2 == 1) {
      for (i = 0; i < n; i++) {
        for (j = 0; j < m; j++) {
          if (ara[i][j] < t) {
            l = i;
            k = j;
            t = ara[i][j];
          }
        }
      }
      ara[l][k] = ara[l][k] * -1;
    }
    sum = 0;
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        sum = sum + ara[i][j];
      }
    }
    printf("%d\n", sum);
  }
  return 0;
}
