#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t-- > 0) {
    int n, m, res = 0;
    cin >> n >> m;
    res = (n * m) / 2;
    if (n % 2 == 1 && m % 2 == 1) res++;
    cout << res << endl;
  }
  return 0;
}
