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