#include <bits/stdc++.h>
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n, m, a;
    scanf("%d%d", &n, &m);
    a = n * m;
    if (a % 2 == 0)
      printf("%d\n", a / 2);
    else
      printf("%d\n", (a / 2) + 1);
  }
  return 0;
}
