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