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