#include <bits/stdc++.h>
using namespace std;
int a[20][20];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n, m;
    scanf("%d%d", &n, &m);
    int sum, minn, ne;
    sum = ne = 0;
    minn = 100;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        scanf("%d", &a[i][j]);
        if (a[i][j] < 0) {
          a[i][j] = -a[i][j];
          ne++;
        }
        sum += a[i][j];
        minn = min(minn, a[i][j]);
      }
    }
    if (ne & 1) {
      sum -= 2 * minn;
    }
    printf("%d\n", sum);
  }
  return 0;
}
